Skip to content

docs(templates): streamline template instructions #9

docs(templates): streamline template instructions

docs(templates): streamline template instructions #9

Workflow file for this run

name: Release Crates
on:
push:
branches:
- main
tags:
- "v*.*.*"
pull_request:
branches:
- main
workflow_dispatch:
inputs:
dry-run:
description: "Perform a dry run without actually publishing"
required: false
type: boolean
default: false
jobs:
publish-crates:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Run tests
run: cargo test --all --locked
- name: Verify package can be built
run: cargo package --locked --allow-dirty
- name: Publish to crates.io (dry-run)
if: github.event_name == 'workflow_dispatch' && inputs.dry-run
run: cargo publish --dry-run --locked
- name: Publish to crates.io
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && !inputs.dry-run)
uses: katyo/publish-crates@v2
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
ignore-unpublished-changes: true
# - name: Create GitHub Release
# if: github.event_name == 'push'
# uses: softprops/action-gh-release@v2
# with:
# generate_release_notes: true
# draft: false
# prerelease: false
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}