-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: automate creation of GitHub releases and tags (#475)
* ci: automate creation of GitHub releases and tags * Added readme update * ci: publish assets to draft github releases * docs: document the new release process and possible improvements * chore: apply suggestions from code review Co-authored-by: Steve Loeppky <[email protected]> * Update RELEASE.md * Update RELEASE.md --------- Co-authored-by: Steve Loeppky <[email protected]>
- Loading branch information
Showing
7 changed files
with
165 additions
and
127 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
name: Release Checker | ||
|
||
on: | ||
pull_request_target: | ||
paths: ["version.json"] | ||
types: [ opened, synchronize, reopened, labeled, unlabeled ] | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
release-check: | ||
uses: ipdxco/unified-github-workflows/.github/workflows/[email protected] | ||
with: | ||
sources: '["version.json"]' | ||
upload-release-assets: | ||
needs: [release-check] | ||
if: fromJSON(needs.release-check.outputs.json)['version.json'] | ||
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: | ||
- run: echo "Running on $RUNNER_OS $RUNNER_ARCH" | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
- uses: ./.github/actions/configure-environment | ||
- if: runner.os == 'macOS' | ||
run: | | ||
cd rust && rustup target add x86_64-apple-darwin | ||
cd rust && cargo fetch | ||
- if: runner.os == 'Linux' | ||
name: Build and publish the standard release | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
run: | | ||
cd rust | ||
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 | ||
- if: runner.os == 'Linux' | ||
name: Build the optimized release | ||
run: | | ||
cd rust | ||
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 | ||
- if: runner.os == 'macOS' | ||
name: Build and publish the universal standard release | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
run: | | ||
cd rust | ||
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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Releaser | ||
|
||
on: | ||
push: | ||
paths: ["version.json"] | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: write | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.sha }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
releaser: | ||
uses: ipdxco/unified-github-workflows/.github/workflows/[email protected] | ||
with: | ||
sources: '["version.json"]' | ||
secrets: | ||
UCI_GITHUB_TOKEN: ${{ secrets.UCI_GITHUB_TOKEN }} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Release Process | ||
|
||
This document describes the process for releasing a new version of the `filecoin-ffi` project. | ||
|
||
## Current State | ||
|
||
1. Create a pull request which updates the `version` in the [top-level `version.json` file](https://github.com/filecoin-project/filecoin-ffi/blob/master/version.json). | ||
- Title the PR `chore: X.Y.Z release` | ||
2. On pull request creation, a [Release Checker](.github/workflows/release-check.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. | ||
3. Create a draft GitHub release with the version as the tag. (A git tag with this version string will be created when the release is published.) | ||
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). | ||
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. | ||
3. Check if a draft GitHub release with the version as the tag exists. | ||
4. If the draft release exists, publish it. Otherwise, create and publish a new release with the version as the git tag. Publishing the release creates the git tag. | ||
|
||
## Known Limitations | ||
|
||
1. If one pushes an update to the `version` in the top-level `version.json` file without creating a pull request, the Release Checker workflow will not run. Hence, the release assets will not be automatically built and uploaded. | ||
|
||
## 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. |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"version": "v1.28.0" | ||
} |