Skip to content

Commit 5ce7285

Browse files
authored
chore: creates the release if and only if does not exist. (#241)
1 parent 02dd3ca commit 5ce7285

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

.github/workflows/ci.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,26 @@ jobs:
154154
cache-to: type=gha,mode=max
155155

156156
- name: Create draft release
157+
# Triggered only on tag creation and if release does not exist
158+
if: matrix.multiphase_eval=='true' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
159+
run: |
160+
set +e
161+
if ! gh release view ${tag}; then
162+
./.github/workflows/release_notes.sh ${tag} > release-notes.txt
163+
gh release create ${tag} --draft --notes-file release-notes.txt --title ${GITHUB_REF#refs/tags/}
164+
fi
165+
env:
166+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
167+
168+
169+
- name: Push build artifact to release
157170
# Triggered only on tag creation
158171
if: matrix.multiphase_eval=='true' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
159172
run: |
160173
ls build
161174
mv build/main.wasm build/coraza-proxy-wasm.wasm
162175
tag="${GITHUB_REF#refs/tags/}"
163176
zip -j build/coraza-proxy-wasm-${tag}.zip build/coraza-proxy-wasm.wasm
164-
./.github/workflows/release_notes.sh ${tag} > release-notes.txt
165-
gh release create ${tag} --draft --notes-file release-notes.txt --title ${GITHUB_REF#refs/tags/} ./build/coraza-proxy-wasm-${tag}.zip
177+
gh release upload ${tag} ./build/coraza-proxy-wasm-${tag}.zip --clobber
166178
env:
167179
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)