chore(version): 0.4.1 #78
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 to Cargo | |
on: | |
push: | |
branches: [ master ] | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
name: "check" | |
strategy: | |
matrix: | |
rust: | |
- stable | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: setup rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: ${{ matrix.rust }} | |
override: true | |
components: rustfmt, clippy | |
- name: setup caching | |
uses: Swatinem/rust-cache@v2 | |
- name: build | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
- name: test | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
- name: fmt | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --all -- --check | |
- name: clippy | |
if: ${{ matrix.rust == 'stable' }} | |
uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
args: --all-features -- -D warnings | |
publish: | |
runs-on: ubuntu-latest | |
needs: check | |
name: 'publish' | |
environment: cargo | |
steps: | |
- uses: actions/checkout@master | |
# v0.1.15 目前版本 | |
- name: Cache publish-action bin | |
id: cache-publish-action | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-publish-action | |
with: | |
path: ~/.cargo | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-v0.2.2 | |
- name: Install publish-action | |
if: steps.cache-publish-action.outputs.cache-hit != 'true' | |
run: | |
cargo install publish-action --version=0.2.2 | |
- name: Run publish-action | |
run: | |
publish-action | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |