-
Notifications
You must be signed in to change notification settings - Fork 7
88 lines (75 loc) · 2.55 KB
/
publish_packages.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
77
78
79
80
81
82
83
84
85
86
87
88
name: Publish Packages
on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to publish packages from'
required: true
default: 'master'
version:
description: 'Version to publish (major, minor, patch)'
required: true
default: 'patch'
type: choice
options:
- 'patch'
- 'minor'
- 'major'
# Do not allow concurrent runs
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
publish:
name: Publish Packages
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ inputs.branch || 'master' }}
- name: Get the secrets from GSM
id: secrets_manager
uses: toptal/davinci-github-action/gsm-secrets@main
with:
workload_identity_provider: ${{ secrets.IDENTITY_POOL }}
service_account: ${{ secrets.SA_IDENTITY_POOL }}
secrets_name: |-
NPM_TOKEN_PUBLISH:toptal-ci/NPM_TOKEN_PUBLISH
TOPTAL_BUILD_BOT_TOKEN:toptal-ci/TOPTAL_BUILD_BOT_TOKEN
- name: Parse secrets
id: parse_secrets
uses: toptal/davinci-github-actions/expose-json-outputs@main
with:
json: ${{ steps.secrets_manager.outputs.secrets }}
- name: Set ENV Variables
run: |-
echo "NPM_TOKEN=${{ steps.parse_secrets.outputs.NPM_TOKEN_PUBLISH }}" >> $GITHUB_ENV
echo "GITHUB_TOKEN=${{ steps.parse_secrets.outputs.TOPTAL_BUILD_BOT_TOKEN }}" >> $GITHUB_ENV
- name: Setup Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16
# Add a registry to npm config.
# 'npm whoami' - is a check of the validity of the NPM token and connection.
- name: Setup npm
run: |
npm set "//registry.npmjs.org/:_authToken=${{ env.NPM_TOKEN }}"
npm whoami
# Lerna should be able to make commits and create tags for new versions in repo as a user.
- name: Configure git user
run: |
git config --global user.email "[email protected]"
git config --global user.name "toptal-bot"
- name: Install Dependencies
run: |
yarn install --frozen-lockfile --non-interactive
- name: Build Packages
run: |
yarn build
- name: Bump versions
run: |
yarn lerna version ${{ inputs.version }} --yes
- name: Publish packages
run: |
yarn lerna publish from-git --yes