Skip to content

chore(actions): updating publish workflow #2

chore(actions): updating publish workflow

chore(actions): updating publish workflow #2

Workflow file for this run

name: Publish
on:
push:
branches:
- master
env:
CARGO_TERM_COLOR: always
jobs:
build:
strategy:
matrix:
rust-channel: [ 'stable', 'nightly' ]
rust-target: [ 'x86_64-unknown-linux-gnu', 'thumbv7em-none-eabi' ]
name: ${{ matrix.rust-channel }}-${{ matrix.rust-target }}
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Install toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ matrix.rust-channel }}
target: ${{ matrix.rust-target }}
- name: Cargo Check
run: cargo check --target ${{ matrix.rust-target }}
- name: Cargo Build
run: cargo build --verbose --target ${{ matrix.rust-target }}
release-please:
name: Execute release chores
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
needs: build
outputs:
created: ${{ steps.release.outputs.release_created }}
steps:
- uses: google-github-actions/release-please-action@v4
id: release
with:
release-type: rust
publish:
name: Publish to crates.io
runs-on: ubuntu-latest
needs: release-please
if: needs.release-please.outputs.created
environment: crates.io
steps:
- uses: actions/checkout@v4
- uses: swatinem/rust-cache@v2
- name: Publish
# https://doc.rust-lang.org/cargo/reference/config.html?highlight=CARGO_REGISTRY_TOKEN#credentials
run: >
cargo publish
--verbose
--locked
--token ${{ secrets.CRATES_TOKEN }}