mirror of
https://github.com/fluencelabs/marine-rs-sdk-test
synced 2024-12-04 23:30:18 +00:00
Add release automation (#16)
This commit is contained in:
parent
71591f412c
commit
5338d6fb9a
98
.github/workflows/publish_release.yml
vendored
Normal file
98
.github/workflows/publish_release.yml
vendored
Normal file
@ -0,0 +1,98 @@
|
||||
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 with wasm32-unknown-unknown
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: nightly
|
||||
profile: minimal
|
||||
override: true
|
||||
- uses: actions-rs/cargo@v1
|
||||
with:
|
||||
toolchain: nightly
|
||||
command: update
|
||||
args: --aggressive
|
||||
|
||||
### Calculate FINAL_VERSION
|
||||
- name: Install jq & sponge
|
||||
run: sudo apt-get update && sudo apt-get --yes --force-yes install jq moreutils
|
||||
|
||||
- name: Install cargo-show cargo-workspaces toml-cli
|
||||
run: cargo install cargo-show cargo-workspaces toml-cli || true
|
||||
|
||||
- name: Calculate the version
|
||||
run: |
|
||||
# install semver and add it to PATH
|
||||
yarn global add semver
|
||||
PATH="$(yarn global bin):$PATH"
|
||||
|
||||
CARGO_TOML="Cargo.toml"
|
||||
# get package name from Cargo.toml
|
||||
PKG_NAME="$(toml get "$CARGO_TOML" package.name | tr -d \")"
|
||||
# get version from Cargo.toml
|
||||
LOCAL_VERSION="$(toml get "$CARGO_TOML" package.version | tr -d \")"
|
||||
|
||||
# Define accumulator array variable
|
||||
ALL_CRATES_VERSIONS=()
|
||||
|
||||
# For all crates in the workspace accumulate its max_version
|
||||
for CRATE_NAME in $(cargo ws list)
|
||||
do
|
||||
CRATE_VERSION="$((cargo show --json "$PKG_NAME" | jq -r .crate.max_version) 2>/dev/null || true)"
|
||||
ALL_CRATES_VERSIONS+=($CRATE_VERSION)
|
||||
done
|
||||
# Take the highest version of all
|
||||
MAX_CRATES_VERSION="$(semver -p ${ALL_CRATES_VERSIONS[@]} | tail -n1 || true)"
|
||||
# Increment patch octet of the highest version
|
||||
NEXT_CRATE_VERSION="$(semver --increment patch "${MAX_CRATES_VERSION}" || true)"
|
||||
|
||||
# take the highest version
|
||||
MAX_VERSION="$(semver "$NEXT_CRATE_VERSION" "$LOCAL_VERSION" | tail -n1)"
|
||||
echo "FINAL_VERSION=$MAX_VERSION" | tee -a $GITHUB_ENV
|
||||
echo "PKG_NAME=$PKG_NAME" | tee -a $GITHUB_ENV
|
||||
|
||||
### === Rust package release ===
|
||||
- name: Login to crates.io
|
||||
run: cargo login ${{ secrets.CRATES_IO_TOKEN }}
|
||||
|
||||
- name: Publish to crates.io
|
||||
run: cargo ws publish --no-git-commit --allow-dirty --yes custom "${{ env.FINAL_VERSION }}"
|
||||
|
||||
### Create a pre-release
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ env.FINAL_VERSION }}
|
||||
release_name: Fluence Network ${{ env.FINAL_VERSION }}
|
||||
body: |
|
||||
- [${{ env.FINAL_VERSION }} @ crates.io](https://crates.io/crates/${{ env.PKG_NAME }}/${{ env.FINAL_VERSION }})
|
||||
draft: false
|
||||
prerelease: true
|
@ -5,7 +5,7 @@ description = "Fluence backend SDK for developing backend applications for the F
|
||||
documentation = "https://docs.rs/fluence/"
|
||||
repository = "https://github.com/fluencelabs/rust-sdk"
|
||||
authors = ["Fluence Labs"]
|
||||
readme = "Readme.md"
|
||||
readme = "README.md"
|
||||
keywords = ["fluence", "sdk", "webassembly"]
|
||||
categories = ["api-bindings", "wasm"]
|
||||
license = "Apache-2.0"
|
||||
|
@ -1,3 +1,5 @@
|
||||
https://img.shields.io/crates/v/fluence?color=green
|
||||
|
||||
## Rust backend SDK
|
||||
|
||||
This SDK intended to run backend application on the Fluence network. More information about usage and some internals could found in [docs](https://fluence-labs.readme.io/docs/rust-backend-sdk).
|
||||
|
Loading…
Reference in New Issue
Block a user