Skip to content

[promote] Mobile bindings and new chains. #5

[promote] Mobile bindings and new chains.

[promote] Mobile bindings and new chains. #5

name: KOS-RS Bump version && Release
on:
pull_request:
branches:
- master
types:
- closed
permissions:
contents: write
jobs:
publish:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
env:
USER: ${{ secrets.GIT_USER }}
TOKEN: ${{ secrets.GIT_PASS }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: RustUp
uses: klever-io/kos-rs/.github/actions/rustup@develop
with:
with_cache: true
- name: Restore .env file
run: echo "$NODES_ENV" | base64 -d > packages/kos-sdk/.env.nodes
env:
NODES_ENV: ${{ secrets.NODES_ENV }}
- name: Run Tests
run: cargo test
# todo: fix grcov
# - name: Run Tests with coverage
# run: |
# cargo install grcov
# export CARGO_INCREMENTAL=0
# export RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"
# export RUSTDOCFLAGS="-Cpanic=abort"
# cargo build
# cargo test
# grcov ./target/debug/ -s . -t lcov --llvm --branch --ignore-not-existing --ignore "/*" -o lcov.info
# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v2
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# files: ./lcov.info
# flags: unittests
# name: codecov-umbrella
# fail_ci_if_error: true
- name: Get PR title
id: pr_data
run: |
PR_TITLE=$(gh pr view https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }} --json title -q ".title")
echo "::set-output name=title::$PR_TITLE"
- name: Bump Version in Cargo.toml
env:
PR_TITLE: ${{ steps.pr_data.outputs.title }}
run: .github/actions/bump-version.sh
- name: Build
run: make webpack-npm
- name: Package kos-js
run: zip -r ./demo/kos-js.zip ./demo/kos || { echo 'Packaging failed'; exit 1; }
- name: Create GitHub Release
run: |
VERSION=$(cat VERSION)
gh release create "v$VERSION" ./demo/kos-js.zip --title "Release v$VERSION" --generate-notes --target master || { echo 'Release creation failed'; exit 1; }
env:
GH_TOKEN: ${{ secrets.GIT_PASS }}
- name: Setup npm module
uses: actions/setup-node@v3
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org/'
scope: '@klever'
always-auth: true
- name: Publish npm module
run: npm publish ./demo/kos --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}