Skip to content

Commit 56ccfd1

Browse files
authored
chore(ci): release process building binaries (#54)
* chore(ci): release ci * fix(ci): release_name * chore(ci): include more information in the body
1 parent 82741b4 commit 56ccfd1

File tree

1 file changed

+102
-0
lines changed

1 file changed

+102
-0
lines changed

.github/workflows/release.yaml

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: "release"
2+
3+
env:
4+
SUBWASM_VERSION: 0.18.0
5+
6+
on:
7+
workflow_dispatch:
8+
inputs:
9+
ref:
10+
description: "Branch or commit to build from"
11+
required: true
12+
default: "main"
13+
release_name:
14+
description: "Name of the new release (e.g. Polkadot stable2412)"
15+
required: true
16+
release_tag:
17+
description: "Tag of the new release (e.g. polkadot-stable2412)"
18+
required: true
19+
20+
jobs:
21+
build-node:
22+
runs-on: ${{ matrix.platform.os }}
23+
permissions:
24+
contents: write
25+
strategy:
26+
matrix:
27+
platform:
28+
- os: ubuntu-22.04
29+
target: aarch64-unknown-linux-gnu
30+
- os: ubuntu-22.04
31+
target: x86_64-unknown-linux-gnu
32+
- os: macos-14
33+
target: aarch64-apple-darwin
34+
- os: macos-14
35+
target: x86_64-apple-darwin
36+
env:
37+
RUSTFLAGS: "${{ matrix.platform.target == 'aarch64-unknown-linux-gnu' && '-C linker=aarch64-linux-gnu-gcc' || '' }}"
38+
path: "target/${{ matrix.platform.target }}/release"
39+
package: "parachain-template-node-${{ matrix.platform.target }}.tar.gz"
40+
41+
steps:
42+
- name: Checkout
43+
uses: actions/checkout@v4
44+
with:
45+
fetch-depth: 0
46+
ref: ${{ github.event.inputs.ref }}
47+
48+
- name: Install dependencies (Linux)
49+
if: contains(matrix.platform.target, 'linux')
50+
run: |
51+
sudo apt-get update
52+
sudo apt-get install -y protobuf-compiler gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
53+
protoc --version
54+
- name: Install dependencies (macOS)
55+
if: contains(matrix.platform.target, 'apple')
56+
run: |
57+
brew install protobuf
58+
protoc --version
59+
- name: Add target
60+
run: rustup target add ${{ matrix.platform.target }}
61+
62+
- name: Build node
63+
run: cargo build --release -p parachain-template-node --target ${{ matrix.platform.target }}
64+
65+
- name: Package binary
66+
run: |
67+
mkdir -p artifacts
68+
cp ${{ env.path }}/parachain-template-node artifacts/
69+
cd artifacts
70+
if [[ "${{ matrix.platform.target }}" == *"linux"* ]]; then
71+
sha256sum parachain-template-node > parachain-template-node.sha256
72+
else
73+
shasum -a 256 parachain-template-node > parachain-template-node.sha256
74+
fi
75+
tar -czf ${{ env.package }} parachain-template-node parachain-template-node.sha256
76+
- name: Upload binary
77+
uses: actions/upload-artifact@v4
78+
with:
79+
name: parachain-template-node-${{ matrix.platform.target }}
80+
path: artifacts/${{ env.package }}
81+
82+
create-release:
83+
needs: build-node
84+
runs-on: ubuntu-latest
85+
permissions:
86+
contents: write
87+
steps:
88+
- name: Download artifacts
89+
uses: actions/download-artifact@v4
90+
with:
91+
path: release-artifacts
92+
93+
- name: Publish Release
94+
uses: softprops/action-gh-release@v1
95+
with:
96+
tag_name: ${{ github.event.inputs.release_tag }}
97+
name: "${{ github.event.inputs.release_name }}"
98+
target_commitish: ${{ github.event.inputs.ref }}
99+
generate_release_notes: true
100+
body: "This release contains the following builds:\n\n- Linux (x86_64)\n- Linux (AArch64)\n- macOS (x86_64)\n- macOS (AArch64)\n\nSHA256 checksums included."
101+
files: |
102+
release-artifacts/**/*.tar.gz

0 commit comments

Comments
 (0)