From 7bbc049770f487a07c8b72b488e9eb68b54197a4 Mon Sep 17 00:00:00 2001 From: Goooler Date: Thu, 30 Apr 2026 11:03:45 +0800 Subject: [PATCH] Improve the release workflow for GH release --- .github/workflows/run.yml | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/.github/workflows/run.yml b/.github/workflows/run.yml index b448909718..e248c6799a 100644 --- a/.github/workflows/run.yml +++ b/.github/workflows/run.yml @@ -11,6 +11,8 @@ on: jobs: build: runs-on: ubuntu-latest + permissions: + contents: write steps: - name: Set variables run: | @@ -26,10 +28,8 @@ jobs: echo "WIN_EXTRA=https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/extra.txt" >> $GITHUB_ENV shell: bash - - name: Checkout + - name: Checkout the current repo uses: actions/checkout@v4 - with: - repository: MetaCubeX/meta-rules-dat - name: Checkout Loyalsoldier/domain-list-custom uses: actions/checkout@v4 @@ -310,23 +310,12 @@ jobs: sha256sum geoip-lite.metadb > geoip-lite.metadb.sha256sum sha256sum GeoLite2-ASN.mmdb > GeoLite2-ASN.mmdb.sha256sum - - name: Delete current release assets - uses: andreaswilli/delete-release-assets-action@v3.0.0 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - tag: latest - deleteOnlyFromDrafts: false - - - name: Create and Upload Release - id: upload_release - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - release_name: Release ${{ env.BUILDTIME }} - tag: latest - file_glob: true - overwrite: true - file: ./publish/* + - name: Delete release if exist then create release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release delete latest --cleanup-tag -y || true + gh release create latest --title "Release ${{ env.BUILDTIME }}" ./publish/* - name: Git push assets to "release" branch run: |