-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generated by cargo-workspaces
- Loading branch information
Showing
1 changed file
with
38 additions
and
17 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,45 @@ | ||
name: Cargo Build & Test | ||
name: Deploy | ||
|
||
on: | ||
release: | ||
types: [published] | ||
push: | ||
tags: | ||
- "v[0-9]+.[0-9]+.[0-9]+" | ||
|
||
jobs: | ||
publish: | ||
name: Publish to crates.io | ||
build-and-upload: | ||
name: Build and upload | ||
runs-on: ${{ matrix.os }} | ||
|
||
runs-on: ubuntu-latest | ||
environment: crates.io | ||
strategy: | ||
matrix: | ||
# You can add more, for any target you'd like! | ||
include: | ||
- build: linux | ||
os: ubuntu-latest | ||
target: x86_64-unknown-linux-musl | ||
|
||
- build: macos | ||
os: macos-latest | ||
target: x86_64-apple-darwin | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: swatinem/rust-cache@v2 | ||
|
||
- name: Publish | ||
# https://doc.rust-lang.org/cargo/reference/config.html?highlight=CARGO_REGISTRY_TOKEN#credentials | ||
run: > | ||
cargo workspaces publish | ||
--verbose | ||
--allow-branch * | ||
--token ${{ secrets.CARGO_REGISTRY_TOKEN }} | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Get the release version from the tag | ||
shell: bash | ||
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | ||
|
||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
target: ${{ matrix.target }} | ||
override: true | ||
|
||
- name: Install Rust | ||
run: rustup target add ${{ matrix.target }} | ||
|
||
- name: Publish to Cargo | ||
run: | | ||
cargo workspaces publish --verbose --allow-branch * --token ${{ secrets.CARGO_REGISTRY_TOKEN }} |