-
Notifications
You must be signed in to change notification settings - Fork 8
76 lines (68 loc) · 2.14 KB
/
publish-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
65
66
67
68
69
70
71
72
73
74
75
76
name: Publish package
on:
workflow_dispatch:
inputs:
package:
type: choice
description: Package to publish
options:
- merge-cli
- storybook-deployer
required: true
tag:
type: choice
description: Package tag
options:
- dev
- latest
required: true
target:
type: choice
description: Target registry
options:
- github
- npmjs
required: true
jobs:
publish:
runs-on: ubuntu-20.04
defaults:
run:
working-directory: packages/uxpin-${{ github.event.inputs.package }}
steps:
- uses: actions/checkout@v2
- name: Set env var based on inputs
run: |
if [ "${{ github.event.inputs.target }}" = "github" ]
then
echo "NPM_REGISTRY_HOST=npm.pkg.github.com" >> $GITHUB_ENV
echo "NPMRC_PUBLISH_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
else
echo "NPM_REGISTRY_HOST=registry.npmjs.com" >> $GITHUB_ENV
echo "NPMRC_PUBLISH_TOKEN=${{ secrets.NPMJS_TOKEN }}" >> $GITHUB_ENV
fi
- name: Use Node.js 16.17.0
uses: actions/setup-node@v1
with:
node-version: 16.17.0
- run: yarn policies set-version 1.22.4
- name: Setting $HOME/.npmrc to install built-utils
run: echo "${NPMRC}" > $HOME/.npmrc
env:
NPMRC: |
@uxpin:registry=https://npm.pkg.github.com/
//npm.pkg.github.com/:_authToken="${{ secrets.NPMRC_READ_TOKEN }}"
- name: Install build-utils
run: yarn global add @uxpin/build-utils
- name: Setting .npmrc to publish a package on github
run: echo "${NPMRC}" > .npmrc
env:
NPMRC: |
@uxpin:registry=https://${{ env.NPM_REGISTRY_HOST }}/
//${{ env.NPM_REGISTRY_HOST }}/:_authToken="${{ env.NPMRC_PUBLISH_TOKEN }}"
- run: make dependencies
- run: make build
- name: publish package
run: bash ../../.github/bin/publish-package.sh
env:
PACKAGE_TAG: ${{ github.event.inputs.tag }}