-
Notifications
You must be signed in to change notification settings - Fork 25
65 lines (57 loc) · 1.58 KB
/
module-gprpublish.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
name: Reusable Node.js Package Workflow
on:
workflow_call:
inputs:
node_version:
type: string
required: true
registry_url:
type: string
required: true
scope:
type: string
default: 'openimis'
access:
type: string
default: 'public'
secrets:
GITHUB_TOKEN:
required: true
jobs:
build_and_publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node_version }}
registry-url: ${{ inputs.registry_url }}
scope: ${{ inputs.scope }}
- name: Update version with TAG
run: |
TAG_NAME=$(git tag --sort=-version:refname | head -n 1)
echo $TAG_NAME
echo $(jq --arg a "$TAG_NAME" '.version = ($a)' package.json) > package.json
- run: yarn install
- run: yarn build
- name: Publish to GPR
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REGISTRY_URL: 'https://npm.pkg.github.com/'
# Use example
# name: Implement Node.js Package Workflow
# on:
# release:
# types: [published]
# jobs:
# call-central-workflow:
# uses: openimis/openimis-fe_js/.github/workflows/module-gprpublish.yml@develop
# with:
# node_version: '18'
# registry_url: 'https://registry.npmjs.org/'
# access: 'public'
# scope: 'openimis'
# publish_to_gpr: true
# secrets:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}