Skip to content

Commit

Permalink
ci: Replace max-parallel with an own job
Browse files Browse the repository at this point in the history
To circumvent a race condition in `softprops/action-gh-release` where two draft releases are created in parallel and artifacts land in different draft releases

Signed-off-by: simonsan <[email protected]>
  • Loading branch information
simonsan committed Feb 2, 2024
1 parent ad4de2b commit 016abab
Showing 1 changed file with 32 additions and 3 deletions.
35 changes: 32 additions & 3 deletions .github/workflows/release-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ jobs:
name: Publishing ${{ matrix.job.target }}
runs-on: ${{ matrix.job.os }}
strategy:
fail-fast: false
max-parallel: 1
fail-fast: false # so we upload the artifacts even if one of the jobs fails
matrix:
rust: [stable]
job:
Expand Down Expand Up @@ -97,6 +96,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:

fetch-depth: 0 # fetch all history so that git describe works
- name: Create binary artifact
uses: rustic-rs/create-binary-artifact-action@main # dev
Expand All @@ -119,6 +119,20 @@ jobs:
use-project-version: true
use-tag-version: true # IMPORTANT: this is being used to make sure the tag that is built is in the archive filename, so automation can download the correct version

create-release:
name: Creating release with artifacts
needs: publish
runs-on: ubuntu-latest
steps:
# Need to clone the repo again for the CHANGELOG.md
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
fetch-depth: 0 # fetch all history so that git describe works

- name: Download all workflow run artifacts
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4

- name: Creating Release
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
with:
Expand All @@ -127,6 +141,21 @@ jobs:
body_path: ${{ github.workspace }}/CHANGELOG.md
fail_on_unmatched_files: true
files: |
${{ env.BINARY_NAME }}-${{ env.PROJECT_VERSION }}-${{ matrix.job.target}}.tar.gz*
binary-*/${{ env.BINARY_NAME }}-*.tar.gz*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

result:
if: ${{ github.repository_owner == 'rustic-rs' }}
name: Result (Release CD)
runs-on: ubuntu-latest
needs:
- publish
- create-release
steps:
- name: Mark the job as successful
run: exit 0
if: success()
- name: Mark the job as unsuccessful
run: exit 1
if: "!success()"

0 comments on commit 016abab

Please sign in to comment.