Skip to content

Commit

Permalink
Update relese.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangwt-cn committed Jul 4, 2024
1 parent 3589253 commit 01c55f8
Showing 1 changed file with 23 additions and 33 deletions.
56 changes: 23 additions & 33 deletions .github/workflows/relese.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,24 @@ on:
workflow_dispatch:

jobs:
create-release:
runs-on: ubuntu-latest

steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
prerelease: false


build:
needs: create-release
runs-on: ubuntu-latest

strategy:
Expand All @@ -32,43 +49,16 @@ jobs:
run: |
zip anki-card-${{ matrix.goos }}-${{ matrix.goarch }}.zip anki-card-${{ matrix.goos }}-${{ matrix.goarch }}
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: anki-card-${{ matrix.goos }}-${{ matrix.goarch }}
path: anki-card-${{ matrix.goos }}-${{ matrix.goarch }}.zip

release:
needs: build
runs-on: ubuntu-latest

steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
prerelease: false
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./anki-card-${{ matrix.goos }}-${{ matrix.goarch }}.zip
asset_name: anki-card-${{ matrix.goos }}-${{ matrix.goarch }}.zip
asset_content_type: application/zip

- name: Download artifacts
uses: actions/download-artifact@v2
with:
path: ./dist

- name: Upload Release Assets
run: |
for file in ./dist/*; do
echo "Uploading $file"
curl -XPOST \
-H "Authorization: token ${{ secrets.TOKEN_GITHUB }}" \
-H "Content-Type: application/octet-stream" \
--data-binary @"$file" \
"${{ steps.create_release.outputs.upload_url }}?name=$(basename "$file")"
done



Expand Down

0 comments on commit 01c55f8

Please sign in to comment.