mirror of
https://github.com/logos-blockchain/logos-blockchain.git
synced 2026-08-01 03:53:14 +00:00
234 lines
8.4 KiB
YAML
234 lines
8.4 KiB
YAML
name: Prepare release draft with built binaries
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}@${{ github.ref_name }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
LB_CIRCUITS_VERSION: v0.4.2
|
|
TEST_TAG_NAME: release-ci-test
|
|
|
|
jobs:
|
|
configure-version:
|
|
name: Configure release version
|
|
if: ${{ github.ref_type == 'tag' }}
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
version: ${{ steps.define-version.outputs.version }}
|
|
|
|
steps:
|
|
# Take the version of the tag from which the workflow is dispatched, or use `0.0.0` for test runs with the `release-ci-test` tag.
|
|
- name: Define version
|
|
id: define-version
|
|
env:
|
|
TAG_NAME: ${{ github.ref_name }}
|
|
run: |
|
|
if [[ "$TAG_NAME" == "${{ env.TEST_TAG_NAME }}" ]]; then
|
|
echo "Test workflow run. Setting version to 0.0.0 for testing."
|
|
VERSION=0.0.0
|
|
elif [[ "$TAG_NAME" =~ ^([0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+)?)$ ]]; then
|
|
echo "Release workflow run for tag '$TAG_NAME'. Setting version to '$TAG_NAME'."
|
|
VERSION="$TAG_NAME"
|
|
else
|
|
echo "Tag name '$TAG_NAME' is not valid. It must either be '${{ env.TEST_TAG_NAME }}' or follow the format 'X.Y.Z[-rc.N]'."
|
|
exit 1
|
|
fi
|
|
|
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
|
|
build:
|
|
name: "Build and tar binaries for ${{ matrix.platform.os-display }} (${{ matrix.platform.arch }})"
|
|
needs: configure-version
|
|
runs-on: ${{ matrix.platform.builder }}
|
|
env:
|
|
VERSION: ${{ needs.configure-version.outputs.version }}
|
|
strategy:
|
|
matrix:
|
|
platform:
|
|
- os: linux
|
|
os-display: Linux
|
|
arch: x86_64
|
|
builder: ubuntu-24.04
|
|
target_triple: x86_64-unknown-linux-gnu
|
|
- os: linux
|
|
os-display: Linux
|
|
arch: aarch64
|
|
builder: ubuntu-24.04-arm
|
|
target_triple: aarch64-unknown-linux-gnu
|
|
- os: macos
|
|
os-display: MacOS
|
|
arch: aarch64
|
|
builder: macos-14
|
|
target_triple: aarch64-apple-darwin
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@85e6279cec87321a52edac9c87bce653a07cf6c2 # Version 4.2.2
|
|
|
|
- name: Add the target triple
|
|
run: rustup target add ${{ matrix.platform.target_triple }}
|
|
|
|
- name: Setup Circuits
|
|
uses: ./.github/actions/setup-circuits
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build node binary
|
|
run: cargo build -p logos-blockchain-node --release --target ${{ matrix.platform.target_triple }}
|
|
|
|
- name: Tar node binary
|
|
run: tar -czf logos-blockchain-node-${{ matrix.platform.os }}-${{ matrix.platform.arch }}-${{ needs.configure-version.outputs.version }}.tar.gz -C target/${{ matrix.platform.target_triple }}/release logos-blockchain-node
|
|
|
|
- name: Upload binary tar (${{ matrix.platform.arch }})
|
|
uses: actions/upload-artifact@6027e3dd177782cd8ab9af838c04fd81a07f1d47 # Version 4.6.2
|
|
with:
|
|
name: logos-blockchain-node-${{ matrix.platform.os }}-${{ matrix.platform.arch }}-${{ needs.configure-version.outputs.version }}
|
|
path: logos-blockchain-node-${{ matrix.platform.os }}-${{ matrix.platform.arch }}-${{ needs.configure-version.outputs.version }}.tar.gz
|
|
if-no-files-found: error
|
|
|
|
download-circuits:
|
|
name: "Download circuits for ${{ matrix.platform.os-display }} (${{ matrix.platform.arch }})"
|
|
needs: configure-version
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
LB_CIRCUITS_REPO_NAME: logos-blockchain/logos-blockchain-circuits
|
|
strategy:
|
|
matrix:
|
|
platform:
|
|
- os: linux
|
|
os-display: Linux
|
|
arch: x86_64
|
|
- os: linux
|
|
os-display: Linux
|
|
arch: aarch64
|
|
- os: macos
|
|
os-display: MacOS
|
|
arch: aarch64
|
|
|
|
steps:
|
|
- name: Download circuits from ${{ env.LB_CIRCUITS_REPO_NAME }} repo
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
LB_CIRCUIT_NAME: logos-blockchain-circuits-${{ env.LB_CIRCUITS_VERSION }}-${{ matrix.platform.os }}-${{ matrix.platform.arch }}.tar.gz
|
|
run: |
|
|
gh release download "${{ env.LB_CIRCUITS_VERSION }}" \
|
|
--repo ${{ env.LB_CIRCUITS_REPO_NAME }} \
|
|
--pattern "${{ env.LB_CIRCUIT_NAME }}"
|
|
|
|
- name: Upload circuits artifact
|
|
uses: actions/upload-artifact@6027e3dd177782cd8ab9af838c04fd81a07f1d47 # Version 4.6.2
|
|
env:
|
|
LB_CIRCUIT_NAME: logos-blockchain-circuits-${{ env.LB_CIRCUITS_VERSION }}-${{ matrix.platform.os }}-${{ matrix.platform.arch }}.tar.gz
|
|
with:
|
|
name: ${{ env.LB_CIRCUIT_NAME }}
|
|
path: ${{ env.LB_CIRCUIT_NAME }}
|
|
if-no-files-found: error
|
|
|
|
create-draft-release:
|
|
name: Create draft release
|
|
needs:
|
|
- configure-version
|
|
- build
|
|
- download-circuits
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
VERSION: ${{ needs.configure-version.outputs.version }}
|
|
outputs:
|
|
upload_url: ${{ steps.create-draft-release.outputs.upload_url }}
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@85e6279cec87321a52edac9c87bce653a07cf6c2 # Version 4.2.2
|
|
|
|
- name: Create Draft Release
|
|
uses: actions/create-release@4c11c9fe1dcd9636620a16455165783b20fc7ea0 # Version 1.1.4
|
|
id: create-draft-release
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: ${{ env.VERSION }}
|
|
release_name: Logos Blockchain Node ${{ env.VERSION }}
|
|
body_path: .github/release/release-content.md
|
|
draft: true
|
|
prerelease: true
|
|
|
|
upload-binaries:
|
|
name: Upload binaries to release
|
|
needs:
|
|
- configure-version
|
|
- create-draft-release
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
platform:
|
|
- os: linux
|
|
arch: x86_64
|
|
- os: linux
|
|
arch: aarch64
|
|
- os: macos
|
|
arch: aarch64
|
|
env:
|
|
UPLOAD_URL: ${{ needs.create-draft-release.outputs.upload_url }}
|
|
BINARY_NAME: logos-blockchain-node-${{ matrix.platform.os }}-${{ matrix.platform.arch }}-${{ needs.configure-version.outputs.version }}
|
|
DOWNLOAD_DIRECTORY: binaries
|
|
|
|
steps:
|
|
- name: Download artifact
|
|
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # Version 4.2.1
|
|
with:
|
|
name: ${{ env.BINARY_NAME }}
|
|
path: ${{ env.DOWNLOAD_DIRECTORY }}
|
|
merge-multiple: true
|
|
|
|
- name: Upload ${{ matrix.platform.os }} (${{ matrix.platform.arch }}) to release
|
|
uses: actions/upload-release-asset@ef2adfe8cb8ebfa540930c452c576b3819990faa # Version 1.0.2
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ env.UPLOAD_URL }}
|
|
asset_path: ${{ env.DOWNLOAD_DIRECTORY }}/${{ env.BINARY_NAME }}.tar.gz
|
|
asset_name: ${{ env.BINARY_NAME }}.tar.gz
|
|
asset_content_type: application/gzip
|
|
|
|
upload-circuits:
|
|
name: Upload circuits to release
|
|
needs:
|
|
- create-draft-release
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
platform:
|
|
- os: linux
|
|
arch: x86_64
|
|
- os: linux
|
|
arch: aarch64
|
|
- os: macos
|
|
arch: aarch64
|
|
env:
|
|
UPLOAD_URL: ${{ needs.create-draft-release.outputs.upload_url }}
|
|
DOWNLOAD_DIRECTORY: circuits
|
|
|
|
steps:
|
|
- name: Download circuits artifact
|
|
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # Version 4.2.1
|
|
env:
|
|
LB_CIRCUIT_NAME: logos-blockchain-circuits-${{ env.LB_CIRCUITS_VERSION }}-${{ matrix.platform.os }}-${{ matrix.platform.arch }}.tar.gz
|
|
with:
|
|
name: ${{ env.LB_CIRCUIT_NAME }}
|
|
path: ${{ env.DOWNLOAD_DIRECTORY }}
|
|
merge-multiple: true
|
|
|
|
- name: Upload circuits ${{ matrix.platform.os }} (${{ matrix.platform.arch }}) to release
|
|
uses: actions/upload-release-asset@ef2adfe8cb8ebfa540930c452c576b3819990faa # Version 1.0.2
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
LB_CIRCUIT_NAME: logos-blockchain-circuits-${{ env.LB_CIRCUITS_VERSION }}-${{ matrix.platform.os }}-${{ matrix.platform.arch }}.tar.gz
|
|
with:
|
|
upload_url: ${{ env.UPLOAD_URL }}
|
|
asset_path: ${{ env.DOWNLOAD_DIRECTORY }}/${{ env.LB_CIRCUIT_NAME }}
|
|
asset_name: ${{ env.LB_CIRCUIT_NAME }}
|
|
asset_content_type: application/gzip
|