Skip to content

Commit

Permalink
Check if release exists
Browse files Browse the repository at this point in the history
  • Loading branch information
hansottowirtz committed Jan 19, 2021
1 parent 7832382 commit 35b7de5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,20 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Variables
id: vars
run: |
librsvg_version=$(cat Dockerfile | grep -Po '(?<=LIBRSVG_VERSION\=)(\d{1,3}.\d{1,3}.\d{1,3})')
sha_short=$(git rev-parse --short HEAD)
echo "::set-output name=librsvg_version::$librsvg_version"
echo "::set-output name=sha_short::$sha_short"
release_exists="true"
git show-ref --tags --quiet --verify -- "refs/tags/$librsvg_version" || release_exists="false"
echo "::set-output name=release_exists::$release_exists"
if [[ "$GITHUB_EVENT_NAME" == "push" ]] && [[ "$GITHUB_REF" == "refs/heads/master" ]]
then
echo "::set-output name=deploy::true"
Expand Down Expand Up @@ -62,8 +69,9 @@ jobs:
with:
name: librsvg-lambda-layer.zip
path: dist/librsvg-layer.zip
if-no-files-found: error
- name: Create release
if: ${{ steps.vars.outputs.deploy == 'true' }}
if: ${{ steps.vars.outputs.deploy == 'true' && steps.vars.outputs.release_exists == 'false' }}
id: create_release
uses: actions/create-release@v1
env:
Expand All @@ -74,7 +82,7 @@ jobs:
draft: false
prerelease: false
- name: Upload release asset
if: ${{ steps.vars.outputs.deploy == 'true' }}
if: ${{ steps.vars.outputs.deploy == 'true' && steps.vars.outputs.release_exists == 'false' }}
id: upload_release_asset
uses: actions/upload-release-asset@v1
env:
Expand Down

0 comments on commit 35b7de5

Please sign in to comment.