Publish Binary Draft #15
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
name: Publish Binary Draft | |
# The code (like generate-release-body) will be taken from the tag version, not master | |
on: | |
workflow_dispatch: | |
inputs: | |
from: | |
description: tag (ex. v0.8.3) to retrieve commit diff from | |
required: true | |
to: | |
description: tag (ex. v0.9.0) to generate release note and srtool runtimes from | |
required: true | |
jobs: | |
####### Building binaries ####### | |
setup-scripts: | |
runs-on: self-hosted | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Upload tools | |
uses: actions/[email protected] | |
with: | |
name: original-tools | |
path: tools | |
build-binary: | |
needs: ["setup-scripts"] | |
runs-on: self-hosted | |
strategy: | |
matrix: | |
cpu: ["", "skylake", "znver3"] | |
env: | |
RUSTFLAGS: "-C target-cpu=${{ matrix.cpu }}" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.inputs.to }} | |
- name: Setup Rust toolchain | |
run: rustup show | |
- name: Build Node | |
run: cargo build --profile=production --all | |
- name: Save parachain binary | |
if: ${{ matrix.cpu == '' }} | |
run: | | |
mkdir -p binaries | |
cp target/production/tanssi-node binaries/tanssi-node | |
cp target/production/container-chain-template-frontier-node binaries/container-chain-template-frontier-node | |
cp target/production/container-chain-template-simple-node binaries/container-chain-template-simple-node | |
- name: Save parachain custom binary | |
if: ${{ matrix.cpu != '' }} | |
run: | | |
mkdir -p binaries | |
cp target/production/tanssi-node binaries/tanssi-node-${{matrix.cpu}} | |
cp target/production/container-chain-template-frontier-node binaries/container-chain-template-frontier-node-${{matrix.cpu}} | |
cp target/production/container-chain-template-simple-node binaries/container-chain-template-simple-node-${{matrix.cpu}} | |
- name: Upload binaries | |
uses: actions/[email protected] | |
with: | |
name: binaries | |
path: binaries | |
####### Prepare the release draft ####### | |
publish-draft-release: | |
runs-on: ubuntu-latest | |
needs: ["build-binary"] | |
outputs: | |
release_url: ${{ steps.create-release.outputs.html_url }} | |
asset_upload_url: ${{ steps.create-release.outputs.upload_url }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.inputs.to }} | |
fetch-depth: 0 | |
- name: Use Node.js 18.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
- name: Download Original Tools | |
uses: actions/download-artifact@v3 | |
with: | |
name: original-tools | |
path: original-tools | |
- name: Generate release body | |
id: generate-release-body | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
working-directory: original-tools | |
run: | | |
yarn | |
yarn -s run ts-node github/generate-release-body.ts --owner "${{ github.repository_owner }}" --repo "$(basename ${{ github.repository }})" --from ${{ github.event.inputs.from }} --to ${{ github.event.inputs.to }} --srtool-report-folder '../build/' > ../body.md | |
- name: Create draft release | |
id: create-release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.event.inputs.to }} | |
release_name: Tanssi ${{ github.event.inputs.to }} | |
body_path: body.md | |
draft: true | |
####### Upload Binaries ####### | |
upload-binaries: | |
runs-on: ubuntu-latest | |
needs: ["build-binary", "publish-draft-release"] | |
strategy: | |
matrix: | |
cpu: ["", "skylake", "znver3"] | |
node: ["tanssi-node", "container-chain-template-frontier-node", "container-chain-template-simple-node"] | |
steps: | |
- uses: actions/[email protected] | |
with: | |
name: binaries | |
path: build | |
- name: Upload tanssi and templates | |
uses: actions/upload-release-asset@v1 | |
if: ${{ matrix.cpu == '' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.publish-draft-release.outputs.asset_upload_url }} | |
asset_path: build/${{matrix.node}} | |
asset_name: ${{matrix.node}} | |
asset_content_type: application/octet-stream | |
- name: Upload tanssi and templates custom binaries | |
uses: actions/upload-release-asset@v1 | |
if: ${{ matrix.cpu != '' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.publish-draft-release.outputs.asset_upload_url }} | |
asset_path: build/${{matrix.node}}-${{matrix.cpu}} | |
asset_name: ${{matrix.node}}-${{matrix.cpu}} | |
asset_content_type: application/octet-stream |