-
Notifications
You must be signed in to change notification settings - Fork 4
91 lines (77 loc) · 2.7 KB
/
pull-master-release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
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: 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 }}