From 85babc7403e5c98e8a7d554fed1dabd89eebbafd Mon Sep 17 00:00:00 2001 From: Alex Bean Date: Wed, 5 Feb 2025 09:38:37 +0100 Subject: [PATCH] chore(ci): release process building binaries (#16) * fix(ci): release_name * chore(ci): include more information in the body --- .github/workflows/release.yaml | 102 +++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..2f39cb8 --- /dev/null +++ b/.github/workflows/release.yaml @@ -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 \ No newline at end of file