-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (62 loc) · 2.05 KB
/
release.yml
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
name: Release
on:
workflow_dispatch:
inputs:
version:
description: set version for this release
default: "minor"
type: choice
options:
- "major"
- "minor"
- "patch"
- "prerelease"
env:
PACKAGE_NAME: "@ledgerhq/exchange-sdk"
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9.4.0
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18.16
registry-url: 'https://registry.npmjs.org'
cache: pnpm
- name: Setup jq
run: sudo apt-get install jq
- name: Setup temp github user
run: |
git config user.email "action@github.com"
git config user.name "Github Bot"
- name: Install Dependencies
run: pnpm --frozen-lockfile --filter exchange-sdk install
- name: Set current npm registry version in package.json
working-directory: ./lib
run: jq --arg v "$(pnpm show $PACKAGE_NAME version)" '.version=$v' package.json > tmp && mv tmp package.json
- name: Create new version
working-directory: ./lib
run: pnpm version ${{ inputs.version }} --no-git-tag-version --workspaces-update false
- name: Build exchange-sdk
run: pnpm --filter exchange-sdk build
- name: Publish package to npm registry
run: pnpm publish --filter exchange-sdk --access public --no-git-checks
env:
NPM_TOKEN: ${{ secrets.NPMJS_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_TOKEN }}
- name: Revert git changes and push version tag
working-directory: ./lib
run: |
VERSION=$(jq ".version" ./package.json)
GIT_HASH=$(git rev-parse --short "$GITHUB_SHA")
git checkout $GIT_HASH -- ./package.json
git tag $VERSION
git push --tags
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}