marine-rs-sdk-test/.github/workflows/publish_release.yml

75 lines
2.0 KiB
YAML
Raw Normal View History

2021-04-28 13:27:09 +00:00
name: "publish-release"
on:
push:
branches:
- "master"
jobs:
npm-publish:
name: "Publish release"
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Checkout repository
uses: actions/checkout@v2
### Prepare cargo & toolchains
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
~/.cargo/bin
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install Rust toolchain
2021-04-28 13:27:09 +00:00
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
profile: minimal
override: true
- uses: actions-rs/cargo@v1
with:
toolchain: nightly
command: update
args: --aggressive
- name: Install jq
run: sudo apt-get update && sudo apt-get --yes --force-yes install jq
2021-04-28 13:27:09 +00:00
- name: Install cargo-workspaces
run: cargo install cargo-workspaces || true
2021-04-28 13:27:09 +00:00
### === Rust package release ===
- name: Login to crates.io
run: cargo login ${{ secrets.CRATES_IO_TOKEN }}
- name: Save marine-rs-sdk's crate version to env
run: |
set -x
PKG_NAME=marine-rs-sdk
2021-06-30 15:28:32 +00:00
VERSION=$(cargo ws list -l | grep "$PKG_NAME\s" | head -n1 | awk '{ print $2 }')
echo "VERSION=$VERSION" | tee -a $GITHUB_ENV
echo "PKG_NAME=$PKG_NAME" | tee -a $GITHUB_ENV
2021-04-28 13:27:09 +00:00
- name: Publish to crates.io
run: cargo ws publish --no-git-commit --from-git --skip-published --yes
2021-04-28 13:27:09 +00:00
2021-06-30 15:28:32 +00:00
### Create a release
2021-04-28 13:27:09 +00:00
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.VERSION }}
release_name: Marine Rust SDK ${{ env.VERSION }}
2021-04-28 13:27:09 +00:00
body: |
- [${{ env.VERSION }} @ crates.io](https://crates.io/crates/${{ env.PKG_NAME }}/${{ env.VERSION }})
2021-04-28 13:27:09 +00:00
draft: false
prerelease: false