Add libbtrfsutil to GitHub Actions #2
Workflow file for this run
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: Publish | |
on: | |
push: | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
jobs: | |
check: | |
uses: cezarmathe/btrfsutil-rs/.github/workflows/check.yml@master | |
secrets: inherit | |
publish: | |
needs: check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
- name: ⚡ Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- name: Extract release version | |
run: echo -n "cargo_version=v$(cargo pkgid | cut -d '#' -f2)" >> $GITHUB_ENV | |
- name: Check release version | |
if: '${{ env.cargo_version != github.ref_name }}' | |
uses: actions/github-script@v3 | |
with: | |
script: | | |
core.setFailed('Tagged version ${{ github.ref_name }} does not match Cargo version v${{ env.cargo_version }}') | |
- name: Publish the new version | |
run: cargo publish --token ${CRATES_TOKEN} | |
env: | |
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }} |