Skip to content

Commit

Permalink
ci: fix release workflow by using softprops/action-gh-release
Browse files Browse the repository at this point in the history
  • Loading branch information
tsonglew committed Dec 7, 2024
1 parent 16764d2 commit ba30ea1
Showing 1 changed file with 18 additions and 39 deletions.
57 changes: 18 additions & 39 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit ba30ea1

Please sign in to comment.