2222jobs :
2323 compile :
2424 name : ${{ matrix.release-name || matrix.target || 'Unknown' }}
25- permissions :
26- contents : write
2725 runs-on : ${{ matrix.os || 'ubuntu-latest' }}
2826 strategy :
2927 fail-fast : false
@@ -317,6 +315,8 @@ jobs:
317315 name : Release
318316 needs : [compile]
319317 runs-on : ubuntu-latest
318+ permissions :
319+ contents : write
320320 steps :
321321 - uses : actions/checkout@v4
322322 with :
@@ -345,9 +345,13 @@ jobs:
345345 ./clash-x86_64-unknown-linux-musl -v >> version.txt
346346 cat version.txt
347347
348- - name : Move latest tag for git-cliff nightly
348+ - name : Clean git tag & release
349349 run : |
350+ gh release delete latest --cleanup-tag --yes --repo $GITHUB_REPOSITORY || true
351+ # Move latest tag to current commit locally
350352 git tag latest -f
353+ env :
354+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
351355
352356 - name : Generate a changelog
353357 uses : orhun/git-cliff-action@main
@@ -370,34 +374,15 @@ jobs:
370374 packages/*
371375 LICENSE*
372376
373- - name : Delete old latest nightly release
374- if : startsWith(github.ref, 'refs/heads/master')
375- uses : actions/github-script@v7
376- with :
377- github-token : ${{secrets.GITHUB_TOKEN}}
378- script : |
379- const tag = 'latest'
380- const { owner, repo } = context.repo
381- const { data: { id } } = await github.rest.repos.getReleaseByTag({ owner, repo, tag })
382- await github.rest.repos.deleteRelease({ owner, repo, release_id: id })
383-
384- - name : Update Latest Tag
385- if : startsWith(github.ref, 'refs/heads/master')
386- uses : richardsimko/update-tag@v1
387- with :
388- tag_name : latest
389- env :
390- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
391-
392377 - name : Github nightly release
393378 uses : softprops/action-gh-release@v2
394379 if : startsWith(github.ref, 'refs/heads/master')
395380 with :
396381 token : ${{ secrets.GITHUB_TOKEN }}
397382 prerelease : true
398- tag_name : " latest"
399383 generate_release_notes : false
400384 body : ${{ steps.git-cliff.outputs.content }}
385+ tag_name : " latest"
401386 files : |
402387 packages/*
403388 LICENSE*
0 commit comments