|
20 | 20 | # -- See list at https://graphviz.gitlab.io/download/ |
21 | 21 | GRAPHVIZ_TAG: 12.1.2 |
22 | 22 |
|
| 23 | + # -- These are set latter. |
| 24 | + RELEASE_TAG: "" |
| 25 | + PACKAGE_TAG: "" |
| 26 | + |
23 | 27 | jobs: |
24 | 28 | # -- Build packages for all supported architectures and |
25 | 29 | # -- export them in a release. |
@@ -163,18 +167,30 @@ jobs: |
163 | 167 | env: |
164 | 168 | GITHUB_TOKEN: ${{ github.token }} |
165 | 169 |
|
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 | | -
|
172 | 170 | # Scans recursively inside the .tgz packages. |
173 | 171 | # See https://linux.die.net/man/1/clamscan |
174 | 172 | - name: Scan the package for viruses |
175 | 173 | run: | |
176 | 174 | clamscan -r --verbose --scan-archive=yes apio-graphviz-*.tgz |
177 | 175 |
|
| 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 | + |
178 | 194 | - name: Create the Release and upload files |
179 | 195 | uses: softprops/action-gh-release@v2.2.2 |
180 | 196 | with: |
|
0 commit comments