name: "Release"
permissions:
contents: "write"
on:
workflow_run:
workflows: ["Tag"]
types:
- "completed"
jobs:
get-tag:
name: "Get tag version from Cargo.toml"
runs-on: "ubuntu-latest"
outputs:
pkg-version: ${{ steps.pkg-version.outputs.PKG_VERSION }}
steps:
- name: "Check out the repo"
uses: actions/checkout@v3
with:
token: ${{ secrets.G_TOKEN }}
- name: "Get tag"
id: "pkg-version"
shell: "bash"
run: |
echo PKG_VERSION=$(awk -F ' = ' '$1 ~ /version/ { gsub(/["]/, "", $2); printf("%s",$2) }' Cargo.toml) >> $GITHUB_OUTPUT
create-release:
name: "Create release"
needs:
- "get-tag"
runs-on: "ubuntu-latest"
steps:
- name: "Check out the repo"
uses: actions/checkout@v3
- name: "Create release"
uses: "taiki-e/create-gh-release-action@v1"
with:
branch: "master"
ref: refs/tags/v${{ needs.get-tag.outputs.pkg-version }}
token: ${{ secrets.G_TOKEN }}
publish-crate:
runs-on: ubuntu-latest
steps:
- name: Set up Rust
uses: hecrj/setup-rust-action@v1
- uses: actions/checkout@v2
- name: Publish
shell: bash
run: cargo publish --token ${{ secrets.CRATES_TOKEN }}