Skip to content

Commit c85a1a6

Browse files
committed
feat: release workflow
1 parent 8d5ba23 commit c85a1a6

File tree

3 files changed

+113
-0
lines changed

3 files changed

+113
-0
lines changed
+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Build and Release
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: []
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-20.04
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v2
16+
with:
17+
submodules: 'true'
18+
19+
- name: Install build-essential, curl, git, wget, and Docker
20+
run: |
21+
sudo apt-get update
22+
sudo apt-get install -y build-essential curl git wget
23+
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
24+
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
25+
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
26+
sudo apt-get update
27+
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
28+
echo "Installed build-essential, curl, git, wget, and Docker"
29+
30+
- name: Setup Rust and Cargo
31+
uses: actions-rs/toolchain@v1
32+
with:
33+
toolchain: 1.51.0
34+
override: true
35+
components: rustc, cargo
36+
37+
- name: Build app
38+
run: sh build.sh
39+
40+
- name: Upload artifact
41+
uses: actions/upload-artifact@v2
42+
with:
43+
name: dist
44+
path: ./dist/
45+
46+
release:
47+
needs: build
48+
runs-on: ubuntu-22.04
49+
50+
steps:
51+
- name: Checkout code
52+
uses: actions/checkout@v2
53+
54+
- name: Download build artifact
55+
uses: actions/download-artifact@v2
56+
with:
57+
name: dist
58+
path: ./dist
59+
60+
- name: Prepare release
61+
run: zip -r dist.zip dist
62+
63+
- name: Get the current date
64+
id: date
65+
run: echo "::set-output name=date::$(date +'%Y-%m-%d-%H-%M')"
66+
67+
- name: Create new release
68+
id: create_release
69+
uses: actions/create-release@v1
70+
env:
71+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72+
with:
73+
tag_name: ${{ steps.date.outputs.date }}
74+
release_name: "Release: ${{ steps.date.outputs.date }}"
75+
draft: false
76+
prerelease: false
77+
body: "Hackachain phase 2 bn256 release at ${{ steps.date.outputs.date }}"
78+
79+
- name: Upload Release Asset
80+
uses: actions/upload-release-asset@v1
81+
env:
82+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83+
with:
84+
upload_url: ${{ steps.create_release.outputs.upload_url }}
85+
asset_name: dist.zip
86+
asset_path: ./dist.zip
87+
asset_content_type: application/zip

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/dist

build.sh

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Use ubuntu 20.04 for building, otherwise the binary will not work on gramine image
2+
3+
cd ./powersoftau
4+
cargo build --release --bin new_constrained
5+
cargo build --release --bin compute_constrained
6+
cargo build --release --bin verify_transform_constrained
7+
cargo build --release --bin beacon_constrained
8+
cargo build --release --bin prepare_phase2
9+
10+
mkdir -p ../dist/bin
11+
cp target/release/new_constrained ../dist/bin
12+
cp target/release/compute_constrained ../dist/bin
13+
cp target/release/verify_transform_constrained ../dist/bin
14+
cp target/release/beacon_constrained ../dist/bin
15+
cp target/release/prepare_phase2 ../dist/bin
16+
17+
cd ../phase2
18+
19+
cargo build --release --bin new
20+
cargo build --release --bin contribute
21+
cargo build --release --bin verify_contribution
22+
23+
cp target/release/new ../dist/bin
24+
cp target/release/contribute ../dist/bin
25+
cp target/release/verify_contribution ../dist/bin

0 commit comments

Comments
 (0)