Skip to content

Commit

Permalink
chore: publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
TurtIeSocks committed Nov 5, 2024
1 parent 8378565 commit c309797
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Publish to crates.io

on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v3

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Cache Cargo registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Cache Cargo index
uses: actions/cache@v3
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-index-
- name: Install toml-cli
run: cargo install toml-cli
- name: Check version
run: test "v$(toml get -r Cargo.toml package.version)" = "${{ github.ref_name }}"

- name: Build and verify the crate
run: cargo publish --dry-run

- name: Publish to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish

0 comments on commit c309797

Please sign in to comment.