Skip to content

Commit

Permalink
chore: creates the release if and only if does not exist. (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcchavezs authored Oct 24, 2023
1 parent 02dd3ca commit 5ce7285
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,26 @@ jobs:
cache-to: type=gha,mode=max

- name: Create draft release
# Triggered only on tag creation and if release does not exist
if: matrix.multiphase_eval=='true' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
run: |
set +e
if ! gh release view ${tag}; then
./.github/workflows/release_notes.sh ${tag} > release-notes.txt
gh release create ${tag} --draft --notes-file release-notes.txt --title ${GITHUB_REF#refs/tags/}
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


- name: Push build artifact to release
# Triggered only on tag creation
if: matrix.multiphase_eval=='true' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
run: |
ls build
mv build/main.wasm build/coraza-proxy-wasm.wasm
tag="${GITHUB_REF#refs/tags/}"
zip -j build/coraza-proxy-wasm-${tag}.zip build/coraza-proxy-wasm.wasm
./.github/workflows/release_notes.sh ${tag} > release-notes.txt
gh release create ${tag} --draft --notes-file release-notes.txt --title ${GITHUB_REF#refs/tags/} ./build/coraza-proxy-wasm-${tag}.zip
gh release upload ${tag} ./build/coraza-proxy-wasm-${tag}.zip --clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 5ce7285

Please sign in to comment.