|
1 | 1 | # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created |
2 | 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages |
3 | 3 |
|
4 | | -name: Node.js Package |
| 4 | +name: Publish Node.js Package |
5 | 5 |
|
6 | 6 | on: |
7 | 7 | release: |
8 | 8 | types: [published] |
| 9 | + workflow_dispatch: |
| 10 | + inputs: |
| 11 | + node_version: |
| 12 | + description: 'Node version to use' |
| 13 | + required: true |
| 14 | + default: '20' |
| 15 | + registry_url: |
| 16 | + description: 'NPM registry URL' |
| 17 | + required: true |
| 18 | + default: 'https://registry.npmjs.org/' |
| 19 | + scope: |
| 20 | + description: 'Scope for npm package' |
| 21 | + required: false |
| 22 | + default: 'openimis' |
| 23 | + access: |
| 24 | + description: 'Access level for npm package' |
| 25 | + required: false |
| 26 | + default: 'public' |
| 27 | + tag: |
| 28 | + required: true |
9 | 29 |
|
10 | 30 | jobs: |
11 | | - build: |
12 | | - runs-on: ubuntu-latest |
13 | | - steps: |
14 | | - - uses: olegtarasov/get-tag@v2.1 |
15 | | - id: tagName |
16 | | - - uses: actions/checkout@v2 |
17 | | - - uses: actions/setup-node@v1 |
18 | | - with: |
19 | | - node-version: 16 |
20 | | - - name: update the version with TAG |
21 | | - run: echo $(jq --arg a "$GIT_TAG_NAME" '.version = ($a)' package.json) > package.json |
22 | | - - run: yarn install |
23 | | - - run: yarn build |
24 | | - |
25 | | - |
26 | | - publish-npm: |
27 | | - needs: build |
28 | | - runs-on: ubuntu-latest |
29 | | - steps: |
30 | | - - uses: olegtarasov/get-tag@v2.1 |
31 | | - id: tagName |
32 | | - - uses: actions/checkout@v2 |
33 | | - - uses: actions/setup-node@v1 |
34 | | - with: |
35 | | - node-version: 16 |
36 | | - registry-url: https://registry.npmjs.org/ |
37 | | - scope: openimis |
38 | | - - name: update the version with TAG |
39 | | - run: echo $(jq --arg a "$GIT_TAG_NAME" '.version = ($a)' package.json) > package.json |
40 | | - - run: yarn install |
41 | | - - run: yarn build |
42 | | - - run: npm publish --access public |
43 | | - env: |
44 | | - NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |
45 | | - |
46 | | - publish-gpr: |
47 | | - needs: build |
48 | | - runs-on: ubuntu-latest |
49 | | - steps: |
50 | | - - uses: olegtarasov/get-tag@v2.1 |
51 | | - id: tagName |
52 | | - - uses: actions/checkout@v2 |
53 | | - - uses: actions/setup-node@v1 |
54 | | - with: |
55 | | - node-version: 16 |
56 | | - registry-url: https://npm.pkg.github.com/ |
57 | | - - name: update the version with TAG |
58 | | - run: echo $(jq --arg a "$GIT_TAG_NAME" '.version = ($a)' package.json) > package.json |
59 | | - - run: yarn install |
60 | | - - run: yarn build |
61 | | - - run: npm publish |
62 | | - env: |
63 | | - NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} |
| 31 | + call-npm-publish-workflow: |
| 32 | + uses: openimis/openimis-fe_js/.github/workflows/module-npmpublish.yml@develop |
| 33 | + with: |
| 34 | + registry_url: 'https://registry.npmjs.org/' |
| 35 | + node_version: ${{ github.event.inputs.node_version || '20' }} |
| 36 | + access: ${{ github.event.inputs.access || 'public' }} |
| 37 | + scope: ${{ github.event.inputs.scope || 'openimis' }} |
| 38 | + tag: ${{ github.event.inputs.tag }} |
| 39 | + secrets: |
| 40 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 41 | + call-gpr-publish-workflow: |
| 42 | + uses: openimis/openimis-fe_js/.github/workflows/module-npmpublish.yml@develop |
| 43 | + with: |
| 44 | + registry_url: 'https://npm.pkg.github.com/' |
| 45 | + node_version: ${{ github.event.inputs.node_version || '20' }} |
| 46 | + access: ${{ github.event.inputs.access || 'public' }} |
| 47 | + scope: ${{ github.event.inputs.scope || 'openimis' }} |
| 48 | + tag: ${{ github.event.inputs.tag }} |
| 49 | + secrets: |
| 50 | + NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments