Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): release process building binaries #16

Merged
merged 2 commits into from
Feb 5, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions .github/workflows/release.yaml
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