mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-03 01:40:21 +08:00
fix(ci): clean stale release drafts before publish
This commit is contained in:
25
.github/workflows/build-proxy.yml
vendored
25
.github/workflows/build-proxy.yml
vendored
@@ -8,6 +8,10 @@ on:
|
|||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: build-proxy-${{ github.ref }}
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
preflight:
|
preflight:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -143,6 +147,27 @@ jobs:
|
|||||||
working-directory: artifacts
|
working-directory: artifacts
|
||||||
run: sha256sum aether-proxy-* > SHA256SUMS.txt
|
run: sha256sum aether-proxy-* > SHA256SUMS.txt
|
||||||
|
|
||||||
|
- name: Delete stale draft releases for tag
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
RELEASE_TAG: ${{ github.ref_name }}
|
||||||
|
REPOSITORY: ${{ github.repository }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
draft_ids="$(gh api "repos/${REPOSITORY}/releases" --paginate --jq '.[] | select(.tag_name == env.RELEASE_TAG and .draft == true) | .id')"
|
||||||
|
|
||||||
|
if [[ -z "${draft_ids}" ]]; then
|
||||||
|
echo "No stale draft releases for ${RELEASE_TAG}"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
while IFS= read -r release_id; do
|
||||||
|
[[ -z "${release_id}" ]] && continue
|
||||||
|
echo "Deleting stale draft release ${release_id} for ${RELEASE_TAG}"
|
||||||
|
gh api -X DELETE "repos/${REPOSITORY}/releases/${release_id}"
|
||||||
|
done <<< "${draft_ids}"
|
||||||
|
|
||||||
- name: Create GitHub Release
|
- name: Create GitHub Release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
|
|||||||
25
.github/workflows/release.yml
vendored
25
.github/workflows/release.yml
vendored
@@ -9,6 +9,10 @@ permissions:
|
|||||||
contents: write
|
contents: write
|
||||||
packages: write
|
packages: write
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: release-aether-${{ github.ref }}
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
env:
|
env:
|
||||||
REGISTRY: ghcr.io
|
REGISTRY: ghcr.io
|
||||||
GHCR_IMAGE: fawney19/aether
|
GHCR_IMAGE: fawney19/aether
|
||||||
@@ -236,6 +240,27 @@ jobs:
|
|||||||
name: release-assets
|
name: release-assets
|
||||||
path: release-assets
|
path: release-assets
|
||||||
|
|
||||||
|
- name: Delete stale draft releases for tag
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
RELEASE_TAG: ${{ github.ref_name }}
|
||||||
|
REPOSITORY: ${{ github.repository }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
draft_ids="$(gh api "repos/${REPOSITORY}/releases" --paginate --jq '.[] | select(.tag_name == env.RELEASE_TAG and .draft == true) | .id')"
|
||||||
|
|
||||||
|
if [[ -z "${draft_ids}" ]]; then
|
||||||
|
echo "No stale draft releases for ${RELEASE_TAG}"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
while IFS= read -r release_id; do
|
||||||
|
[[ -z "${release_id}" ]] && continue
|
||||||
|
echo "Deleting stale draft release ${release_id} for ${RELEASE_TAG}"
|
||||||
|
gh api -X DELETE "repos/${REPOSITORY}/releases/${release_id}"
|
||||||
|
done <<< "${draft_ids}"
|
||||||
|
|
||||||
- name: Publish GitHub Release assets
|
- name: Publish GitHub Release assets
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
|
|||||||
Reference in New Issue
Block a user