From ba30ea150da54b0901261deb673c37a3ff9d9ecd Mon Sep 17 00:00:00 2001 From: Tsong Lew Date: Sun, 8 Dec 2024 00:34:54 +0800 Subject: [PATCH] ci: fix release workflow by using softprops/action-gh-release --- .github/workflows/release.yml | 57 +++++++++++------------------------ 1 file changed, 18 insertions(+), 39 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2b0ea9e..3e1bc16 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,27 +5,13 @@ on: tags: - 'v*' -jobs: - create-release: - name: Create Release - runs-on: ubuntu-latest - outputs: - upload_url: ${{ steps.create_release.outputs.upload_url }} - steps: - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: Release ${{ github.ref }} - draft: false - prerelease: false +permissions: + contents: write + packages: write - build-and-upload: - name: Build and Upload - needs: create-release +jobs: + build-and-release: + name: Build and Release runs-on: macos-latest steps: - uses: actions/checkout@v3 @@ -41,30 +27,23 @@ jobs: cd target/release tar -czf dutis-macos.tar.gz dutis shasum -a 256 dutis-macos.tar.gz > dutis-macos.tar.gz.sha256 + cd ../.. + mv target/release/dutis-macos.tar.gz . + mv target/release/dutis-macos.tar.gz.sha256 . - - name: Upload Release Binary - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.create-release.outputs.upload_url }} - asset_path: target/release/dutis-macos.tar.gz - asset_name: dutis-macos.tar.gz - asset_content_type: application/gzip - - - name: Upload Checksum - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Create Release + uses: softprops/action-gh-release@v1 with: - upload_url: ${{ needs.create-release.outputs.upload_url }} - asset_path: target/release/dutis-macos.tar.gz.sha256 - asset_name: dutis-macos.tar.gz.sha256 - asset_content_type: text/plain + files: | + dutis-macos.tar.gz + dutis-macos.tar.gz.sha256 + draft: false + prerelease: false + generate_release_notes: true publish-crate: name: Publish to crates.io - needs: build-and-upload + needs: build-and-release runs-on: ubuntu-latest steps: - uses: actions/checkout@v3