-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (63 loc) · 2.04 KB
/
publish.yaml
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
on:
workflow_dispatch:
inputs:
publishAll:
type: choice
required: true
description: If true, will publish all packages
options:
- 'false'
- 'true'
dryRun:
type: choice
required: true
description: If true, will not publish and push
options:
- 'false'
- 'true'
env:
NX_BASE: latest
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Use Node.js 16.x
uses: actions/setup-node@v2
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org/'
always-auth: true
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'
- name: Install dependencies
run: yarn install --frozen-lockfile --prefer-offline
- name: Setup git
run: |
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git config --global user.name "${{ github.actor }}"
- name: Resolve nx command
id: nx-command
run: |
command=$([ "${{ github.event.inputs.publishAll }}" = "true" ] && echo "yarn nx run-many --all" || echo "yarn nx affected")
echo "::set-output name=value::$command"
- name: Bump versions
run: ${{ steps.nx-command.outputs.value }} --target=version
- name: Build packages
run: ${{ steps.nx-command.outputs.value }} --target=build
- name: Publish packages
if: ${{ github.event.inputs.dryRun == 'false' }}
run: ${{ steps.nx-command.outputs.value }} --target=publish
env:
NODE_AUTH_TOKEN: ${{ secrets.PUBLISHING_TOKEN }}
- run: git push --follow-tags origin main
if: ${{ github.event.inputs.dryRun == 'false' }}
- name: Update 'latest' tag
if: ${{ github.event.inputs.dryRun == 'false' }}
run: |
git tag --force latest
git push origin --force latest