-
Notifications
You must be signed in to change notification settings - Fork 4
64 lines (56 loc) · 1.78 KB
/
release-npm-package.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
name: Release ROR resource models to npm
on:
push:
tags:
- 'v*'
env:
PACKAGE_NAME: ror-resources
PACKAGE_ORG: "@rork8s"
PACKAGE_PATH: "typescript/models"
jobs:
setenv:
permissions:
contents: read
runs-on: ubuntu-latest
outputs:
rorversion: ${{ steps.env.outputs.ROR_VERSION }}
shortsha: ${{ steps.env.outputs.SHA_SHORT }}
steps:
- uses: actions/checkout@v3
- id: env
name: Set env
run: |
echo "ROR_VERSION=${GITHUB_REF#refs/*/}" >> "$GITHUB_OUTPUT"
echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
publish-ror-resource-models:
if: github.ref_type == 'tag'
runs-on: ubuntu-latest
needs: setenv
defaults:
run:
working-directory: ${{ env.PACKAGE_PATH }}
permissions:
contents: read
packages: write
id-token: write
steps:
- uses: actions/checkout@v3
- name: Install jq
uses: dcarbone/[email protected]
- name: Use node.js
uses: actions/setup-node@v3
with:
node-version: '22.x'
- name: Build package
run: |
export VERSION=${ROR_VERSION#v*}
echo "Building ${{ env.PACKAGE_ORG }}/${{ env.PACKAGE_NAME }} ${VERSION} (${{ needs.setenv.outputs.shortsha}})"
mv package.json package-backup.json
jq --arg rorversion ${VERSION} --arg shortsha ${{ needs.setenv.outputs.shortsha}} '.version = $rorversion | .commit = $shortsha' package-backup.json > package.json
npm ci
npm run build
npm pack
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPMPUBLISHTOKEN }}" > ~/.npmrc
npm publish --access public
env:
ROR_VERSION: ${{ needs.setenv.outputs.rorversion }}