Merge pull request #261 from rustic-rs/ci-betas

Fix race condition when uploading beta builds
This commit is contained in:
aawsome 2022-10-15 00:42:07 +02:00 committed by GitHub
commit 466a650c19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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