Publish #9
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 | |
on: | |
workflow_dispatch | |
env: | |
rust_toolchain: nightly | |
CRATE_NAME: edge-net | |
jobs: | |
publish: | |
name: Publish | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup | Checkout | |
uses: actions/checkout@v2 | |
- name: Setup | Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ env.rust_toolchain }} | |
- name: Setup | Std | |
run: rustup component add rust-src --toolchain ${{ env.rust_toolchain }}-x86_64-unknown-linux-gnu | |
- name: Setup | Default to nightly | |
run: rustup default ${{ env.rust_toolchain }} | |
- name: Login | |
run: cargo login ${{ secrets.crates_io_token }} | |
- name: Build | Publish | |
run: 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: v${{env.crate_version}} | |
message: "Release v${{env.crate_version}}" |