Skip to content

Commit aabf9e4

Browse files
[Github Actions] Don't release same version twice
1 parent 65166ff commit aabf9e4

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

.github/workflows/postman.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ jobs:
7373
7474
ext=${{ matrix.extension }}
7575
file=$(ls postman*${ext})
76+
sha256sum "${file}"
7677
rm -v "${file}"
7778
7879
mv postman* Postman
@@ -117,7 +118,9 @@ jobs:
117118
118119
- name : "Create Postman archive"
119120
run: |
120-
tar --xz -cf postman-${{ matrix.os_type }}-${{ env.VERSION }}.tar.xz ./Postman
121+
FILENAME=postman-${{ matrix.os_type }}-${{ env.VERSION }}.tar.xz
122+
echo "FILENAME=${FILENAME}" >> $GITHUB_ENV
123+
tar --xz -cf "$FILENAME" ./Postman
121124
ls -lh
122125
123126
- name : "Calculate Checksum"
@@ -128,7 +131,23 @@ jobs:
128131
echo -n "SHA256: " | tee -a checksum
129132
sha256sum postman*.tar.xz | tee -a checksum
130133
134+
- name: Check if we already released this version to skip Release File Step
135+
run: |
136+
url="https://github.com/${{ github.repository }}/releases/download/$VERSION/$FILENAME"
137+
echo "[DEBUG] URL = ${url}"
138+
139+
status_code=$(curl -sLo /dev/null -w "%{http_code}" "$url")
140+
141+
echo "[DEBUG] Status Code = ${status_code}"
142+
143+
if [[ "$status_code" == "404" ]]; then
144+
echo "RELEASE=true" >> $GITHUB_ENV
145+
else
146+
echo "[WARNING] ============================ SKIPPED CREATING RELEASE ============================"
147+
fi
148+
131149
- name: Release Files
150+
if: ${{ env.RELEASE }}
132151
uses: softprops/action-gh-release@master # use @master to be able to use append_body, use @v1 when it is released
133152
with:
134153
name: "Postman v${{ env.VERSION }}"

0 commit comments

Comments
 (0)