Skip to content
Merged
Show file tree
Hide file tree
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
73 changes: 73 additions & 0 deletions .github/actions/upload-release-assets/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Upload Release Assets
description: Build and upload release assets to an existing GitHub release

inputs:
id:
description: The release ID
required: true
ref:
description: The release ref
required: true

runs:
using: 'composite'
steps:
- run: echo "Running on $RUNNER_OS $RUNNER_ARCH"
shell: bash
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
submodules: recursive
- uses: ./.github/actions/configure-environment
- if: runner.os == 'macOS'
run: |
rustup target add x86_64-apple-darwin
cargo fetch
working-directory: rust
shell: bash
- if: runner.os == 'Linux'
name: Build and publish the standard release
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_RELEASE_URL: ${{ github.api_url }}/repos/${{ github.repository }}/releases/${{ inputs.id }}
run: |
REPOSITORY_NAME=${GITHUB_REPOSITORY##*/}

TARBALL_PATH="/tmp/${REPOSITORY_NAME}-$(uname)-$(uname -m)-standard.tar.gz"
RELEASE_NAME="${REPOSITORY_NAME}-$(uname)-$(uname -m)-standard"

# Note: the blst dependency uses the portable configuration for maximum compatibility
./scripts/build-release.sh build --verbose --no-default-features --features multicore-sdr,opencl,blst-portable
./scripts/package-release.sh $TARBALL_PATH
./scripts/publish-release.sh $TARBALL_PATH $RELEASE_NAME
working-directory: rust
shell: bash
- if: runner.os == 'Linux'
name: Build the optimized release
run: |
REPOSITORY_NAME=${GITHUB_REPOSITORY##*/}

TARBALL_PATH="/tmp/${REPOSITORY_NAME}-$(uname)-$(uname -m)-optimized.tar.gz"
RUSTFLAGS="-C target-feature=$(cat rustc-target-features-optimized.json | jq -r '.[].rustc_target_feature' | tr '\n' ',')"

./scripts/build-release.sh build --verbose --no-default-features --features multicore-sdr,opencl
./scripts/package-release.sh $TARBALL_PATH
working-directory: rust
shell: bash
- if: runner.os == 'macOS'
name: Build and publish the universal standard release
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_RELEASE_URL: ${{ github.api_url }}/repos/${{ github.repository }}/releases/${{ inputs.id }}
run: |
REPOSITORY_NAME=${GITHUB_REPOSITORY##*/}

RELEASE_NAME="${REPOSITORY_NAME}-$(uname)-standard"
TARBALL_PATH="/tmp/${RELEASE_NAME}.tar.gz"

# Note: the blst dependency uses the portable configuration for maximum compatibility
./scripts/build-release.sh lipo --verbose --no-default-features --features multicore-sdr,opencl,blst-portable
./scripts/package-release.sh $TARBALL_PATH
./scripts/publish-release.sh $TARBALL_PATH $RELEASE_NAME
working-directory: rust
shell: bash
53 changes: 2 additions & 51 deletions .github/workflows/release-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,56 +29,7 @@ jobs:
runner: ['ubuntu-latest', ['self-hosted', 'linux', 'arm64', 'xlarge'], 'macos-latest']
fail-fast: false
steps:
- run: echo "Running on $RUNNER_OS $RUNNER_ARCH"
- uses: actions/checkout@v4
- uses: ./.github/actions/upload-release-assets
with:
submodules: recursive
- uses: ./.github/actions/configure-environment
- if: runner.os == 'macOS'
run: |
rustup target add x86_64-apple-darwin
cargo fetch
working-directory: rust
- if: runner.os == 'Linux'
name: Build and publish the standard release
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_RELEASE_URL: ${{ github.api_url }}/repos/${{ github.repository }}/releases/${{ fromJSON(needs.release-check.outputs.json)['version.json'].id }}
run: |
REPOSITORY_NAME=${GITHUB_REPOSITORY##*/}

TARBALL_PATH="/tmp/${REPOSITORY_NAME}-$(uname)-$(uname -m)-standard.tar.gz"
RELEASE_NAME="${REPOSITORY_NAME}-$(uname)-$(uname -m)-standard"

# Note: the blst dependency uses the portable configuration for maximum compatibility
./scripts/build-release.sh build --verbose --no-default-features --features multicore-sdr,opencl,blst-portable
./scripts/package-release.sh $TARBALL_PATH
./scripts/publish-release.sh $TARBALL_PATH $RELEASE_NAME
working-directory: rust
- if: runner.os == 'Linux'
name: Build the optimized release
run: |
REPOSITORY_NAME=${GITHUB_REPOSITORY##*/}

TARBALL_PATH="/tmp/${REPOSITORY_NAME}-$(uname)-$(uname -m)-optimized.tar.gz"
RUSTFLAGS="-C target-feature=$(cat rustc-target-features-optimized.json | jq -r '.[].rustc_target_feature' | tr '\n' ',')"

./scripts/build-release.sh build --verbose --no-default-features --features multicore-sdr,opencl
./scripts/package-release.sh $TARBALL_PATH
working-directory: rust
- if: runner.os == 'macOS'
name: Build and publish the universal standard release
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_RELEASE_URL: ${{ github.api_url }}/repos/${{ github.repository }}/releases/${{ fromJSON(needs.release-check.outputs.json)['version.json'].id }}
run: |
REPOSITORY_NAME=${GITHUB_REPOSITORY##*/}

RELEASE_NAME="${REPOSITORY_NAME}-$(uname)-standard"
TARBALL_PATH="/tmp/${RELEASE_NAME}.tar.gz"

# Note: the blst dependency uses the portable configuration for maximum compatibility
./scripts/build-release.sh lipo --verbose --no-default-features --features multicore-sdr,opencl,blst-portable
./scripts/package-release.sh $TARBALL_PATH
./scripts/publish-release.sh $TARBALL_PATH $RELEASE_NAME
working-directory: rust
id: ${{ fromJSON(needs.release-check.outputs.json)['version.json'].id }}
34 changes: 34 additions & 0 deletions .github/workflows/upload-release-assets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Upload Release Assets

on:
workflow_dispatch:
inputs:
id:
description: The release ID (e.g. 246546694)
required: true
ref:
description: The release ref (e.g. refs/tags/v1.34.0)
required: true

permissions:
contents: write
pull-requests: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
upload-release-assets:
name: Publish the static library (${{ matrix.runner }})
runs-on: ${{ matrix.runner }}
strategy:
matrix:
runner: ['ubuntu-latest', ['self-hosted', 'linux', 'arm64', 'xlarge'], 'macos-latest']
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/upload-release-assets
with:
id: ${{ inputs.id }}
ref: ${{ inputs.ref }}
2 changes: 2 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ This document describes the process for releasing a new version of the `filecoin
4. Comment on the pull request with a link to the draft release.
5. Build the project for Linux (X64), Linux (ARM64), and MacOS.
7. Upload the built assets to the draft release (replace any existing assets with the same name).
- If for some reason asset uploading fails, the [Upload Release Assets](.github/workflows/upload-release-assets.yml) workflow can be manually run.
3. On pull request merge, a [Releaser](.github/workflows/release.yml) workflow will run. It will perform the following actions:
1. Extract the version from the top-level `version.json` file.
2. Check if a git tag for the version already exists. Continue only if it does not.
Expand All @@ -26,3 +27,4 @@ This document describes the process for releasing a new version of the `filecoin
## Possible Improvements

1. Add a check to the [Releaser](.github/workflows/release.yml) workflow to ensure that the created/published release contains the expected assets. If it does not, create them and run the [publish-release.sh](rust/scripts/publish-release.sh) script to upload the missing assets.
- In the interim, if for some reason asset uploading fails, the [Upload Release Assets](.github/workflows/upload-release-assets.yml) workflow can be manually run.