-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Expand file tree
/
Copy pathcallable-npm-publish-lts-release.yml
More file actions
72 lines (64 loc) · 2.57 KB
/
Copy pathcallable-npm-publish-lts-release.yml
File metadata and controls
72 lines (64 loc) · 2.57 KB
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
name: Release LTS version to npm and update repository
on:
workflow_call:
inputs:
target:
required: true
type: string
jobs:
deploy:
name: Publish to Amplify Package
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
path: amplify-js
token: ${{ secrets.GH_TOKEN_AMPLIFY_JS_WRITE }}
# Minimal depth 0 so we can fetch all git tags.
fetch-depth: 0
- name: Setup node and build the repository
uses: ./amplify-js/.github/actions/node-and-build
- name: Run npm publish
uses: ./amplify-js/.github/actions/npm-publish
with:
target: ${{ inputs.target }}
npm_token: ${{ secrets.NPM_TOKEN }}
github_user: ${{ vars.GH_USER}}
github_email: ${{ vars.GH_EMAIL}}
- name: Promote amazon-cognito-identity-js to the "latest" dist-tag
working-directory: ./amplify-js
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
# amazon-cognito-identity-js is the only unscoped package whose "latest"
# dist-tag must track the v5 line; the rest of the fleet rides "stable-5".
# This previously lived in the package's "postpublish" hook, where lerna
# ran it mid-parallel-publish, swallowed its output, and a single failure
# aborted the entire release. Running it here as an explicit, sequential
# step makes the result visible and retryable without re-publishing.
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> ~/.npmrc
PKG=amazon-cognito-identity-js
VERSION=$(node -p "require('./packages/${PKG}/package.json').version")
echo "Setting ${PKG}@${VERSION} as latest"
npm dist-tag add "${PKG}@${VERSION}" latest
- name: Set github commit user
env:
GITHUB_EMAIL: ${{ vars.GH_EMAIL }}
GITHUB_USER: ${{ vars.GH_USER }}
run: |
git config --global user.email $GITHUB_EMAIL
git config --global user.name $GITHUB_USER
- name: Update API documentation
working-directory: ./amplify-js
run: |
yarn run docs
git add ./docs/api/
git commit -m "chore(release): update API docs [ci skip]"
- name: Push post release changes
working-directory: ./amplify-js
env:
TARGET_BRANCH: ${{ inputs.target }}
run: |
git pull --rebase origin "$TARGET_BRANCH"
git push origin "$TARGET_BRANCH"