-
Notifications
You must be signed in to change notification settings - Fork 306
51 lines (49 loc) · 1.94 KB
/
reusable-tagged-publish.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
# Description: this is a reusable workflow that runs unit and e2e tests.
#
# See `./test-prs.yml` to see an example usage.
on:
workflow_call:
inputs:
dist-tag:
# commit to run tests against
required: true
type: string
secrets:
NPM_TOKEN:
required: true
jobs:
publish:
runs-on: ubuntu-latest
environment: deployment
steps:
- name: fail this workflow if dist-tag is invalid
if: ${{ inputs.dist-tag == '' || inputs.dist-tag == 'latest' }}
run: exit 1
- name: Checkout repo
uses: actions/checkout@b80ff79f1755d06ba70441c368a6fe801f5f3a62 # v4.1.3 https://github.com/actions/checkout/commit/cd7d8d697e10461458bc61a30d094dc601a8b017
- name: Setup Node.js 20
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 https://github.com/actions/setup-node/commit/60edb5dd545a775178f52524783378180af0d1f8
with:
node-version: 20
cache: 'yarn'
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 2
- name: Install packages
uses: ./.github/actions/install-with-retries
with:
skip-cypress-binary: true # publishing doesn't need cypress
- name: Build packages
run: yarn build
- name: Add changeset that bumps all public packages
# There needs to be a changeset for @aws-amplify/ui[-framework] to publish.
run: cp .github/changeset-presets/bump-versions.md .changeset
- name: Run changeset version to next tag
run: yarn changeset version --snapshot ${{ inputs.dist-tag }}-$(git rev-parse --short=7 HEAD) && yarn angular build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create .npmrc
run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish to next tag
run: yarn changeset publish --tag ${{ inputs.dist-tag }}