mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 08:45:41 +08:00
feat: add job to clean old release assets before uploading new ones
This commit is contained in:
64
.github/workflows/autobuild.yml
vendored
64
.github/workflows/autobuild.yml
vendored
@@ -140,6 +140,20 @@ jobs:
|
|||||||
Created at ${{ env.BUILDTIME }}.
|
Created at ${{ env.BUILDTIME }}.
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
- name: Remove old assets from release
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
TAG_NAME: ${{ env.TAG_NAME }}
|
||||||
|
run: |
|
||||||
|
VERSION=$(cat package.json | jq -r '.version')
|
||||||
|
assets=$(gh release view "$TAG_NAME" --json assets -q '.assets[].name' || true)
|
||||||
|
for asset in $assets; do
|
||||||
|
if [[ "$asset" != *"$VERSION"* ]]; then
|
||||||
|
echo "Deleting old asset: $asset"
|
||||||
|
gh release delete-asset "$TAG_NAME" "$asset" -y
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
- name: Upload Release
|
- name: Upload Release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
@@ -150,6 +164,28 @@ jobs:
|
|||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
generate_release_notes: true
|
generate_release_notes: true
|
||||||
|
|
||||||
|
clean_old_assets:
|
||||||
|
name: Clean Old Release Assets
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: update_tag
|
||||||
|
if: ${{ needs.update_tag.result == 'success' }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Remove old assets from release
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
TAG_NAME: ${{ env.TAG_NAME }}
|
||||||
|
run: |
|
||||||
|
VERSION=$(cat package.json | jq -r '.version')
|
||||||
|
assets=$(gh release view "$TAG_NAME" --json assets -q '.assets[].name' || true)
|
||||||
|
for asset in $assets; do
|
||||||
|
if [[ "$asset" != *"$VERSION"* ]]; then
|
||||||
|
echo "Deleting old asset: $asset"
|
||||||
|
gh release delete-asset "$TAG_NAME" "$asset" -y
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
autobuild-x86-windows-macos-linux:
|
autobuild-x86-windows-macos-linux:
|
||||||
name: Autobuild x86 Windows, MacOS and Linux
|
name: Autobuild x86 Windows, MacOS and Linux
|
||||||
needs: update_tag
|
needs: update_tag
|
||||||
@@ -354,6 +390,20 @@ jobs:
|
|||||||
echo "VERSION=$(cat package.json | jq '.version' | tr -d '"')" >> $GITHUB_ENV
|
echo "VERSION=$(cat package.json | jq '.version' | tr -d '"')" >> $GITHUB_ENV
|
||||||
echo "BUILDTIME=$(TZ=Asia/Shanghai date)" >> $GITHUB_ENV
|
echo "BUILDTIME=$(TZ=Asia/Shanghai date)" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Remove old assets from release
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
TAG_NAME: ${{ env.TAG_NAME }}
|
||||||
|
run: |
|
||||||
|
VERSION=$(cat package.json | jq -r '.version')
|
||||||
|
assets=$(gh release view "$TAG_NAME" --json assets -q '.assets[].name' || true)
|
||||||
|
for asset in $assets; do
|
||||||
|
if [[ "$asset" != *"$VERSION"* ]]; then
|
||||||
|
echo "Deleting old asset: $asset"
|
||||||
|
gh release delete-asset "$TAG_NAME" "$asset" -y
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
- name: Upload Release
|
- name: Upload Release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
@@ -451,6 +501,20 @@ jobs:
|
|||||||
Rename-Item $file.FullName $newName
|
Rename-Item $file.FullName $newName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- name: Remove old assets from release
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
TAG_NAME: ${{ env.TAG_NAME }}
|
||||||
|
run: |
|
||||||
|
VERSION=$(cat package.json | jq -r '.version')
|
||||||
|
assets=$(gh release view "$TAG_NAME" --json assets -q '.assets[].name' || true)
|
||||||
|
for asset in $assets; do
|
||||||
|
if [[ "$asset" != *"$VERSION"* ]]; then
|
||||||
|
echo "Deleting old asset: $asset"
|
||||||
|
gh release delete-asset "$TAG_NAME" "$asset" -y
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
- name: Upload Release
|
- name: Upload Release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
|
|||||||
Reference in New Issue
Block a user