Skip to content

Commit

Permalink
feat: Delete Releases and Renamed Release (#1) (#468)
Browse files Browse the repository at this point in the history
Delete Releases and Renamed Release
  • Loading branch information
EricBartusch authored Sep 20, 2024
1 parent d7e7b15 commit 825fa89
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions .github/workflows/generate-soh-archive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,14 @@ name: Generate SoH Archive

on:
push:
branches: [ "Custom-Music-2.0" ]
branches: [ "Custom-Music-2.0" ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Get short commit hash
id: vars
run: echo "short_hash=$(git rev-parse --short HEAD)" >> "$GITHUB_ENV"

- name: Generate SoH archive
run: |
cd data
Expand All @@ -28,24 +24,26 @@ jobs:
name: daruniasjoy.otr
path: data/mods

# If this repo gets reverted to a previous release or if this workflow ever gets re-ran, creating a new release would break the build
# If you really want to regenerate the release, you'll have to manually delete the release
- name: Check for existing release

- name: List all releases
run: |
releases=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${{ github.repository }}/releases)
if echo "$releases" | grep -q "tag_name\": \"main-$short_hash"; then
echo "Release already exists"
exit 1
fi
echo "$releases" | jq -r '.[].id' > release_ids.txt
- name: Delete all releases
run: |
while IFS= read -r release_id; do
curl -X DELETE -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${{ github.repository }}/releases/$release_id
done < release_ids.txt
- name: Create GitHub Release
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: Build-${{ env.short_hash }}
tag_name: latest
draft: false
prerelease: false

Expand All @@ -55,4 +53,5 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: data/mods/daruniasjoy.otr
tag_name: Build-${{ env.short_hash }}
tag_name: latest
name: Ship of Harkinian Bundle

0 comments on commit 825fa89

Please sign in to comment.