From 258848fea874bd37f801ad357fcb004978f0bd9a Mon Sep 17 00:00:00 2001 From: Alexander Weiss Date: Sat, 15 Oct 2022 00:15:00 +0200 Subject: [PATCH] Fix race condition when uploading beta builds --- .github/workflows/release.yaml | 35 +++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index ea2869b..0bcab69 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -83,7 +83,7 @@ jobs: cd target/${{ matrix.job.target }}/release ########## create tar.gz ########## - RELEASE_NAME=rustic-${GITHUB_REF_NAME}-${{ matrix.job.target}} + RELEASE_NAME=rustic-${{ github.ref_name }}-${{ matrix.job.target}} tar czvf $RELEASE_NAME.tar.gz rustic${{ matrix.job.binary-postfix }} ########## create sha256 ########## @@ -92,8 +92,29 @@ jobs: else shasum -a 256 $RELEASE_NAME.tar.gz > $RELEASE_NAME.sha256 fi + - name: Storing binary as artefact + uses: actions/upload-artifact@v3 + with: + name: binary-${{ matrix.job.target}} + path: target/${{ matrix.job.target }}/release/rustic-${{ github.ref_name }}-${{ matrix.job.target}}.tar.gz + - name: Releasing release versions + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: | + target/${{ matrix.job.target }}/release/rustic-*.tar.gz + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + publish-beta: + name: Publishing beta-builds + needs: publish + if: ${{ github.ref == 'refs/heads/main' }} + runs-on: ubunut-latest + steps: + - name: Download all workflow run artifacts + uses: actions/download-artifact@v3 - name: Releasing beta builds - if: ${{ github.ref == 'refs/heads/main' }} shell: bash run: | # set up some directories @@ -118,7 +139,7 @@ jobs: mkdir -p $WORKING_DIR/$DEST_DIR # do the copy - cp -a target/${{ matrix.job.target }}/release/rustic-*.tar.gz $WORKING_DIR/$DEST_DIR + for i in binary-*; do cp -a $i/* $WORKING_DIR/$DEST_DIR; done # create the commit cd $WORKING_DIR @@ -126,14 +147,6 @@ jobs: git commit -m "${{ github.job }} from https://github.com/${{ github.repository }}/commit/${{ github.sha }}" || echo GIT_SSH_COMMAND=$GIT_SSH git pull --rebase GIT_SSH_COMMAND=$GIT_SSH git push - - name: Releasing release versions - uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') - with: - files: | - target/${{ matrix.job.target }}/release/rustic-*.tar.gz - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # publish-cargo: # name: Publishing to Cargo