Skip to content

Commit

Permalink
Update docker-image-to-release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
firerui authored Sep 3, 2024
1 parent 83b6182 commit 9d8eaf5
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions .github/workflows/docker-image-to-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,19 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3

- name: actions/checkout@v3
uses: Nats-ji/delete-old-releases@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
keep-count: 1
keep-old-minor-releases: true
- name: Delete Previous Release
run: |
# 获取最新的release的tag名
PREVIOUS_TAG=$(curl --silent "https://api.github.com/repos/$GITHUB_REPOSITORY/releases/latest" | jq -r .tag_name)
if [ "$PREVIOUS_TAG" != "null" ]; then
# 删除release
curl -X DELETE -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/$GITHUB_REPOSITORY/releases/tags/$PREVIOUS_TAG"
echo "Previous release $PREVIOUS_TAG deleted."
else
echo "No previous release found."
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
Expand Down

0 comments on commit 9d8eaf5

Please sign in to comment.