Skip to content

Commit 3671963

Browse files
authored
Merge pull request #11 from zapta/main
Changed the build workflow to fail if a stable release (non prerelease) of same date already exists.
2 parents 7c7774f + 2ca9dbe commit 3671963

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

.github/workflows/build-and-release.yaml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ env:
2020
# -- See list at https://graphviz.gitlab.io/download/
2121
GRAPHVIZ_TAG: 12.1.2
2222

23+
# -- These are set latter.
24+
RELEASE_TAG: ""
25+
PACKAGE_TAG: ""
26+
2327
jobs:
2428
# -- Build packages for all supported architectures and
2529
# -- export them in a release.
@@ -163,18 +167,30 @@ jobs:
163167
env:
164168
GITHUB_TOKEN: ${{ github.token }}
165169

166-
# In case we overwrite and exiting release.
167-
- name: Force tag update
168-
run: |
169-
git tag -f ${{env.RELEASE_TAG}}
170-
git push origin -f ${{env.RELEASE_TAG}}
171-
172170
# Scans recursively inside the .tgz packages.
173171
# See https://linux.die.net/man/1/clamscan
174172
- name: Scan the package for viruses
175173
run: |
176174
clamscan -r --verbose --scan-archive=yes apio-graphviz-*.tgz
177175
176+
- name: Delete same tag pre-release if exist.
177+
run: |
178+
# Status values:
179+
# "false" - exists and is a release exists
180+
# "true" - exists and is a pre-release
181+
# "" - doesn't exist
182+
status=$(gh release view "$RELEASE_TAG" --json isPrerelease -q .isPrerelease || true)
183+
echo "Status is [$status]"
184+
if [[ "$status" == "false" ]]; then
185+
echo "Error: A stable release (non pre-release) already exists for tag $RELEASE_TAG."
186+
exit 1
187+
elif [[ "$status" == "true" ]]; then
188+
echo "Deleting existing pre-release and tag $RELEASE_TAG."
189+
gh release delete "$RELEASE_TAG" --yes --cleanup-tag
190+
fi
191+
env:
192+
GITHUB_TOKEN: ${{ github.token }}
193+
178194
- name: Create the Release and upload files
179195
uses: softprops/action-gh-release@v2.2.2
180196
with:

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"apio",
44
"clamav",
55
"clamscan",
6+
"elif",
67
"FNAME",
78
"freshclam",
89
"GRAPHVIZ",

0 commit comments

Comments
 (0)