Repository navigation
80 lines (71 loc) · 3.28 KB
/
Copy pathrelease-version.yml
File metadata and controls
80 lines (71 loc) · 3.28 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
73
74
75
76
77
78
79
80
name: "[Release] Version Packages"
on:
push:
branches:
- develop
workflow_dispatch:
env:
FORCE_COLOR: "1"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
version:
name: Maintain version pull request
# Merging `changeset-release/develop` back into develop consumes every changeset,
# so the push it triggers has nothing left to version. Keyed on the commit message
# rather than the actor: a merge commit is attributed to whoever clicked merge, not
# to the bot. Covers all three merge strategies - "Merge pull request #N from
# LedgerHQ/changeset-release/develop" (merge), and the versioning commit itself
# under squash ("chore(release): version packages (#N)") and rebase.
#
# A `[skip ci]` marker in the changesets commit message would be simpler but also
# skips `pull_request` runs, so the version PR would never get the `CI` check that
# develop's ruleset requires.
if: >-
!startsWith(github.event.head_commit.message, 'chore(release): version packages')
&& !contains(github.event.head_commit.message, 'changeset-release/')
runs-on: public-ledgerhq-shared-medium
permissions:
contents: write
pull-requests: write
id-token: write # JFrog OIDC login
steps:
# An app token is required rather than GITHUB_TOKEN: pull requests opened by
# GITHUB_TOKEN do not trigger workflows, so the `CI` check that develop's
# ruleset requires would never run and the version PR would be unmergeable.
- name: Generate app token
id: app-token
uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0
with:
app-id: ${{ secrets.GH_BOT_APP_ID }}
private-key: ${{ secrets.GH_BOT_PRIVATE_KEY }}
permission-contents: write
permission-pull-requests: write
# Full history: @changesets/changelog-github resolves the commit that added
# each changeset file to attribute the changelog entry.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- uses: jdx/mise-action@d5574b52816a478f9d4e6529a3f6ff17a8a36785 # v5.2.8
- uses: LedgerHQ/ts-libs/.github/actions/jfrog-npm-auth@develop
with:
registry: ${{ vars.ARTIFACTORY_URL }}
- name: Install dependencies
run: pnpm install --frozen-lockfile
# No `publish-script` on purpose: with changesets present the action maintains
# the `changeset-release/develop` pull request, and with none present it returns
# early instead of publishing. Publishing happens from main in release.yml.
#
# Do not add a GITHUB_TOKEN env var here - the action throws if it is set and
# differs from `github-token`. It injects the app token into the version script
# itself, which is how changelog-github authenticates.
- name: Create or update version pull request
uses: changesets/action@ae32849d5ba541f9ae29e40e22a623bc13562f51 # v2.1.2
with:
github-token: ${{ steps.app-token.outputs.token }}
commit-message: "chore(release): version packages"
pr-title: "chore(release): version packages"