Skip to content

PublishCargoPio

PublishCargoPio #7

name: PublishCargoPio
on: workflow_dispatch
jobs:
publish:
name: Publish
runs-on: ubuntu-latest
env:
CRATE_NAME: cargo-pio
steps:
- name: Setup | Checkout
uses: actions/checkout@v3
- name: Setup | Rust
uses: dtolnay/rust-toolchain@v1
with:
toolchain: nightly
component: rust-src
- name: Login
run: cargo login ${{ secrets.crates_io_token }}
- name: Build | Publish
run: cd ${{env.CRATE_NAME}}; cargo publish
- name: Get the crate version from cargo
run: |
version=$(cargo metadata --format-version=1 --no-deps | jq -r ".packages[] | select(.name == \"${{env.CRATE_NAME}}\") | .version")
echo "crate_version=$version" >> $GITHUB_ENV
echo "${{env.CRATE_NAME}} version: $version"
- name: Tag the new release
uses: rickstaa/action-create-tag@v1
with:
tag: ${{env.CRATE_NAME}}-v${{env.crate_version}}
message: "Release ${{env.CRATE_NAME}} v${{env.crate_version}}"