Github Release #28
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Github Release | |
on: | |
workflow_dispatch: | |
workflow_run: | |
workflows: ["CI"] | |
branches: [main] | |
types: | |
- completed | |
jobs: | |
extract-crate-version: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Export Crate Package Version | |
run: echo "VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].version')" >> $GITHUB_OUTPUT | |
id: export_crate_version | |
outputs: | |
VERSION: ${{ steps.export_crate_version.outputs.VERSION }} | |
release: | |
name: Release on Github | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
needs: [extract-crate-version] | |
env: | |
VERSION: ${{ needs.extract-crate-version.outputs.VERSION }} | |
steps: | |
- uses: actions/checkout@v4 | |
- run: cargo build --release | |
- name: Generate the Release Tarball | |
run: tar --directory=target/release -cf release.tar.gz $(ls -U target/release/ | head -1) | |
- uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "release.tar.gz" | |
tag: v${{ env.VERSION }} |