Skip to content

Commit

Permalink
ci: add release protection (#283)
Browse files Browse the repository at this point in the history
  • Loading branch information
shakyShane authored Dec 30, 2024
1 parent 6412170 commit b17e682
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/release-protection.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Delete manually created release

on:
release:
types:
- created

jobs:
validate-release:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v3

- name: Delete Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Deleting release: ${{ github.event.release.tag_name }}"
gh release delete ${{ github.event.release.tag_name }} --yes
- name: Delete the release and tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Deleting tag: ${{ github.event.release.tag_name }}"
git tag -d ${{ github.event.release.tag_name }}
git push origin --delete ${{ github.event.release.tag_name }}
- name: Why was this release deleted?
run: |
cat <<EOF
Our release process commits assets to the 'releases' branch - and that has to occur before the
git tag is created. Because of that fact, we need to prevent anyone from creating a release in the GitHub UI.
Instead, use the release workflow.
EOF

0 comments on commit b17e682

Please sign in to comment.