Skip to content

Commit

Permalink
feat: release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
1Mateus committed Mar 8, 2024
1 parent 765d415 commit ae8b1ec
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 0 deletions.
87 changes: 87 additions & 0 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Build and Release

on:
push:
branches: [ main ]
pull_request:
branches: []

jobs:
build:
runs-on: ubuntu-20.04

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: 'true'

- name: Install build-essential, curl, git, wget, and Docker
run: |
sudo apt-get update
sudo apt-get install -y build-essential curl git wget
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
echo "Installed build-essential, curl, git, wget, and Docker"
- name: Setup Rust and Cargo
uses: actions-rs/toolchain@v1
with:
toolchain: 1.51.0
override: true
components: rustc, cargo

- name: Build app
run: sh build.sh

- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: dist
path: ./dist/

release:
needs: build
runs-on: ubuntu-22.04

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Download build artifact
uses: actions/download-artifact@v2
with:
name: dist
path: ./dist

- name: Prepare release
run: zip -r dist.zip dist

- name: Get the current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d-%H-%M')"

- name: Create new release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.date.outputs.date }}
release_name: "Release: ${{ steps.date.outputs.date }}"
draft: false
prerelease: false
body: "Hackachain phase 2 bn256 release at ${{ steps.date.outputs.date }}"

- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: dist.zip
asset_path: ./dist.zip
asset_content_type: application/zip
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/dist
25 changes: 25 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use ubuntu 20.04 for building, otherwise the binary will not work on gramine image

cd ./powersoftau
cargo build --release --bin new_constrained
cargo build --release --bin compute_constrained
cargo build --release --bin verify_transform_constrained
cargo build --release --bin beacon_constrained
cargo build --release --bin prepare_phase2

mkdir -p ../dist/bin
cp target/release/new_constrained ../dist/bin
cp target/release/compute_constrained ../dist/bin
cp target/release/verify_transform_constrained ../dist/bin
cp target/release/beacon_constrained ../dist/bin
cp target/release/prepare_phase2 ../dist/bin

cd ../phase2

cargo build --release --bin new
cargo build --release --bin contribute
cargo build --release --bin verify_contribution

cp target/release/new ../dist/bin
cp target/release/contribute ../dist/bin
cp target/release/verify_contribution ../dist/bin

0 comments on commit ae8b1ec

Please sign in to comment.