-
Notifications
You must be signed in to change notification settings - Fork 531
84 lines (75 loc) · 2.85 KB
/
release-please.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
77
78
79
80
81
82
83
84
on:
push:
branches:
- main
name: Run Release Please
jobs:
release-please:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
# The logic below handles the npm publication:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
# If you update this version make sure to keep in sync:
# - `build-and-cache` job of unit-test workflow
# - `build-and-cache` job of test-all-versions workflow
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
- name: Install packages
run: |
npm ci
- uses: googleapis/release-please-action@7987652d64b4581673a76e33ad5e98e3dd56832f # v4.1.3
id: release
with:
token: ${{secrets.RELEASE_PR_TOKEN}}
target-branch: main
# get release PR as we're currently on main
- name: Checkout release PR
# only checkout if a PR has been created, otherwise this will fail
if: ${{ steps.release.outputs.pr }}
uses: actions/checkout@v4
with:
ref: release-please--branches--main
# use a token so that workflows on the PR run when we push later
token: ${{ secrets.RELEASE_PR_TOKEN }}
# release-please does not do this on its own, so we do it here instead
- name: Update package-lock.json in PR
# only update if a PR has been created
if: ${{ steps.release.outputs.pr }}
run: |
npm install --ignore-scripts --package-lock-only
git add package-lock.json
git config user.name opentelemetrybot
git config user.email [email protected]
git commit -m "chore: sync package-lock.json"
git push
# get main again
- name: Checkout Repository
# only checkout if a release has been created
if: ${{ steps.release.outputs.releases_created }}
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Rebuild Packages
# only rebuild if a release has been created
if: ${{ steps.release.outputs.releases_created }}
run: |
npm ci
npm run compile
# Release Please has already incremented versions and published tags, so we just
# need to publish all unpublished versions to npm here
# See: https://github.com/lerna/lerna/tree/main/commands/publish#bump-from-package
- name: Publish to npm
# only publish if a release has been created
if: ${{ steps.release.outputs.releases_created }}
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NPM_CONFIG_PROVENANCE: true
run: npx lerna publish from-package --no-push --no-private --no-git-tag-version --no-verify-access --yes