Skip to content

Commit d922800

Browse files
galarghStebalien
andauthored
ci: upload release again before the release is published (#1658)
* ci: upload release again before the release is published * fix: wait for release assets upload before publishing * ci: do not upload release assets to a release in a pr * fix: take release id and ref as an input to the upload release assets workflow * doc: update release docs Releases are now built on merge. And, from what I can tell, they _should_ be built even if/when we bypass the merge process. * ci: fix the concurrency group of the release check * ci: remove concurrency group from upload release assets * ci: do not fail release upload fast * ci: simplify release assets upload --------- Co-authored-by: Steven Allen <steven@stebalien.com>
1 parent 67ac726 commit d922800

File tree

4 files changed

+80
-47
lines changed

4 files changed

+80
-47
lines changed

.github/workflows/release-check.yml

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,44 +11,11 @@ permissions:
1111
pull-requests: write
1212

1313
concurrency:
14-
group: ${{ github.workflow }}-${{ github.ref }}
14+
group: ${{ github.workflow }}-${{ github.event.pull_request.head.ref || github.ref }}
1515
cancel-in-progress: true
1616

1717
jobs:
1818
release-check:
1919
uses: ipdxco/unified-github-workflows/.github/workflows/release-check.yml@v1.0
2020
with:
2121
sources: '["Cargo.toml"]'
22-
upload-release-assets:
23-
needs: [release-check]
24-
if: fromJSON(needs.release-check.outputs.json)['Cargo.toml']
25-
runs-on: ubuntu-latest
26-
env:
27-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28-
CARGO_INCREMENTAL: 0
29-
CACHE_SKIP_SAVE: ${{ matrix.push == '' || matrix.push == 'false' }}
30-
RUSTFLAGS: -Dwarnings
31-
strategy:
32-
matrix:
33-
network: [ 'mainnet', 'caterpillarnet', 'butterflynet', 'calibrationnet', 'devnet', 'testing', 'testing-fake-proofs' ]
34-
steps:
35-
- name: Checking out
36-
uses: actions/checkout@v4
37-
- name: Setting up cache
38-
uses: pl-strflt/rust-sccache-action@v1
39-
env:
40-
SCCACHE_CACHE_SIZE: 2G
41-
SCCACHE_DIR: ${{ github.workspace }}/.cache/sccache
42-
CACHE_SKIP_SAVE: true
43-
- name: Writing bundle
44-
env:
45-
BUILD_FIL_NETWORK: ${{ matrix.network }}
46-
run: |
47-
make bundle-repro
48-
- name: Upload release assets to GitHub Release
49-
env:
50-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51-
GITHUB_RELEASE_URL: ${{ github.api_url }}/repos/${{ github.repository }}/releases/${{ fromJSON(needs.release-check.outputs.json)['Cargo.toml'].id }}
52-
BUILD_FIL_NETWORK: ${{ matrix.network }}
53-
run: |
54-
./scripts/upload-release-assets.sh

.github/workflows/releaser.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,30 @@ permissions:
99
contents: write
1010

1111
concurrency:
12-
group: ${{ github.workflow }}-${{ github.sha }}
12+
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.sha }}
1313
cancel-in-progress: true
1414

1515
jobs:
16+
# Create/update a draft release if this is a release creating push event
17+
draft:
18+
uses: ipdxco/unified-github-workflows/.github/workflows/releaser.yml@v1.0
19+
with:
20+
sources: '["Cargo.toml"]'
21+
draft: true
22+
# If a draft release was created/updated, build and upload release assets
23+
upload-release-assets:
24+
needs: [draft]
25+
if: fromJSON(needs.draft.outputs.json)['Cargo.toml']
26+
uses: ./.github/workflows/upload-release-assets.yml
27+
with:
28+
release_id: ${{ fromJSON(needs.draft.outputs.json)['Cargo.toml'].id }}
29+
# If a draft release was created/update, publish the release
1630
releaser:
31+
needs: [draft, upload-release-assets]
32+
if: fromJSON(needs.draft.outputs.json)['Cargo.toml']
1733
uses: ipdxco/unified-github-workflows/.github/workflows/releaser.yml@v1.0
1834
with:
1935
sources: '["Cargo.toml"]'
36+
draft: false
2037
secrets:
2138
UCI_GITHUB_TOKEN: ${{ secrets.UCI_GITHUB_TOKEN }}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Upload Release Assets
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release_id:
7+
description: 'The id of the release to upload the assets for'
8+
required: true
9+
type: string
10+
release_ref:
11+
description: 'The ref to build the release assets from'
12+
required: false
13+
type: string
14+
workflow_call:
15+
inputs:
16+
release_id:
17+
required: true
18+
type: string
19+
release_ref:
20+
required: false
21+
type: string
22+
23+
permissions:
24+
contents: write
25+
26+
jobs:
27+
upload-release-assets:
28+
runs-on: ubuntu-latest
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
network: [ 'mainnet', 'caterpillarnet', 'butterflynet', 'calibrationnet', 'devnet', 'testing', 'testing-fake-proofs' ]
35+
steps:
36+
- name: Checking out builtin-actors
37+
uses: actions/checkout@v4
38+
with:
39+
ref: ${{ inputs.release_ref || github.ref }}
40+
- name: Writing bundle
41+
env:
42+
BUILD_FIL_NETWORK: ${{ matrix.network }}
43+
run: |
44+
make bundle-repro
45+
- name: Upload release assets to GitHub Release
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
GITHUB_RELEASE_URL: ${{ github.api_url }}/repos/${{ github.repository }}/releases/${{ inputs.release_id }}
49+
BUILD_FIL_NETWORK: ${{ matrix.network }}
50+
run: |
51+
git checkout $GITHUB_REF -- scripts/upload-release-assets.sh
52+
./scripts/upload-release-assets.sh

RELEASE.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,18 @@ This document describes the process for releasing a new version of the `builtin-
99
2. On pull request creation, a [Release Checker](.github/workflows/release-check.yml) workflow will run. It will perform the following actions:
1010
1. Extract the version from the top-level `Cargo.toml` file.
1111
2. Check if a git tag for the version already exists. Continue only if it does not.
12-
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.)
12+
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.)
1313
4. Comment on the pull request with a link to the draft release.
14-
5. Build `builtin-actors.car`s for various networks.
15-
6. Generate checksums for the built `builtin-actors.car`s.
16-
7. Upload the built `builtin-actors.car`s and checksums as assets to the draft release (replace any existing assets with the same name).
17-
3. On pull request merge, a [Releaser](.github/workflows/release.yml) workflow will run. It will perform the following actions:
14+
3. On pull request merge, a [Releaser](.github/workflows/releaser.yml) workflow will run. It will perform the following actions:
1815
1. Extract the version from the top-level `Cargo.toml` file.
1916
2. Check if a git tag for the version already exists. Continue only if it does not.
20-
3. Check if a draft GitHub release with the version as the tag exists.
21-
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.
17+
3. Check if a draft GitHub release with the version as the tag exists. Otherwise, create it.
18+
4. Trigger the [Upload Release Assets](.github/workflows/upload-release-assets.yml) workflow to:
19+
1. Build `builtin-actors.car`s for various networks.
20+
2. Generate checksums for the built `builtin-actors.car`s.
21+
3. Upload the built `builtin-actors.car`s and checksums as assets to the draft release.
22+
5. Publish the draft release. Publishing the release creates the git tag.
2223

2324
## Known Limitations
2425

25-
1. If one pushes an update to the `workspace.package.version` in the top-level `Cargo.toml` file without creating a pull request, the Release Checker workflow will not run. Hence, the release assets will not be automatically built and uploaded.
26-
27-
## Possible Improvements
28-
29-
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 [upload-release-assets.sh](scripts/upload-release-assets.sh) script to upload the missing assets.
26+
1. Unless triggered manually, release assets will only be built after merging the release PR.

0 commit comments

Comments
 (0)