-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): release process building binaries (#54)
* chore(ci): release ci * fix(ci): release_name * chore(ci): include more information in the body
- Loading branch information
Showing
1 changed file
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
name: "release" | ||
|
||
env: | ||
SUBWASM_VERSION: 0.18.0 | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
ref: | ||
description: "Branch or commit to build from" | ||
required: true | ||
default: "main" | ||
release_name: | ||
description: "Name of the new release (e.g. Polkadot stable2412)" | ||
required: true | ||
release_tag: | ||
description: "Tag of the new release (e.g. polkadot-stable2412)" | ||
required: true | ||
|
||
jobs: | ||
build-node: | ||
runs-on: ${{ matrix.platform.os }} | ||
permissions: | ||
contents: write | ||
strategy: | ||
matrix: | ||
platform: | ||
- os: ubuntu-22.04 | ||
target: aarch64-unknown-linux-gnu | ||
- os: ubuntu-22.04 | ||
target: x86_64-unknown-linux-gnu | ||
- os: macos-14 | ||
target: aarch64-apple-darwin | ||
- os: macos-14 | ||
target: x86_64-apple-darwin | ||
env: | ||
RUSTFLAGS: "${{ matrix.platform.target == 'aarch64-unknown-linux-gnu' && '-C linker=aarch64-linux-gnu-gcc' || '' }}" | ||
path: "target/${{ matrix.platform.target }}/release" | ||
package: "parachain-template-node-${{ matrix.platform.target }}.tar.gz" | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ github.event.inputs.ref }} | ||
|
||
- name: Install dependencies (Linux) | ||
if: contains(matrix.platform.target, 'linux') | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y protobuf-compiler gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | ||
protoc --version | ||
- name: Install dependencies (macOS) | ||
if: contains(matrix.platform.target, 'apple') | ||
run: | | ||
brew install protobuf | ||
protoc --version | ||
- name: Add target | ||
run: rustup target add ${{ matrix.platform.target }} | ||
|
||
- name: Build node | ||
run: cargo build --release -p parachain-template-node --target ${{ matrix.platform.target }} | ||
|
||
- name: Package binary | ||
run: | | ||
mkdir -p artifacts | ||
cp ${{ env.path }}/parachain-template-node artifacts/ | ||
cd artifacts | ||
if [[ "${{ matrix.platform.target }}" == *"linux"* ]]; then | ||
sha256sum parachain-template-node > parachain-template-node.sha256 | ||
else | ||
shasum -a 256 parachain-template-node > parachain-template-node.sha256 | ||
fi | ||
tar -czf ${{ env.package }} parachain-template-node parachain-template-node.sha256 | ||
- name: Upload binary | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: parachain-template-node-${{ matrix.platform.target }} | ||
path: artifacts/${{ env.package }} | ||
|
||
create-release: | ||
needs: build-node | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Download artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: release-artifacts | ||
|
||
- name: Publish Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
tag_name: ${{ github.event.inputs.release_tag }} | ||
name: "${{ github.event.inputs.release_name }}" | ||
target_commitish: ${{ github.event.inputs.ref }} | ||
generate_release_notes: true | ||
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." | ||
files: | | ||
release-artifacts/**/*.tar.gz |