Skip to content

Commit

Permalink
chore(ci): release process building binaries (#54)
Browse files Browse the repository at this point in the history
* chore(ci): release ci

* fix(ci): release_name

* chore(ci): include more information in the body
  • Loading branch information
AlexD10S authored Feb 3, 2025
1 parent 82741b4 commit 56ccfd1
Showing 1 changed file with 102 additions and 0 deletions.
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

0 comments on commit 56ccfd1

Please sign in to comment.