Skip to content

Commit 3a8efa5

Browse files
ci: trusted publishing (#2327)
1 parent 26700f0 commit 3a8efa5

File tree

2 files changed

+62
-29
lines changed

2 files changed

+62
-29
lines changed

.github/workflows/release.yml

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,21 @@ name: release
33
on:
44
workflow_dispatch:
55
inputs:
6-
npmTag:
6+
versionType:
77
type: choice
8-
description: 'NPM tag to release'
8+
description: 'Version type to publish'
99
options:
1010
- latest
1111
- next
1212
required: true
1313
default: "latest"
1414

1515
jobs:
16-
release:
16+
publish:
1717
runs-on: ubuntu-latest
18+
permissions:
19+
id-token: write
20+
contents: read
1821

1922
steps:
2023
- uses: actions/checkout@v4
@@ -35,32 +38,7 @@ jobs:
3538
- name: Build packages
3639
run: yarn release:build
3740

38-
- name: Unit Testing
39-
run: yarn test:ci
40-
41-
- name: Linting & Types
42-
run: yarn lint:all
43-
44-
- name: Creates local .npmrc
45-
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
46-
47-
- name: Prepare Lingui-Bot git account
48-
uses: oleksiyrudenko/gha-git-credentials@v2-latest
49-
with:
50-
name: 'Lingui Bot'
51-
52-
actor: 'lingui-bot'
53-
token: '${{ secrets.GH_TOKEN }}'
54-
55-
- name: Versioning packages
56-
env:
57-
GH_TOKEN: ${{ secrets.GH_TOKEN }}
58-
run: yarn version:${{github.event.inputs.npmTag}}
59-
60-
- name: Packaging packages with newer version
61-
run: yarn release:build
62-
6341
- name: Publishing packages
6442
env:
6543
GH_TOKEN: ${{ secrets.GH_TOKEN }}
66-
run: yarn release:${{github.event.inputs.npmTag}}
44+
run: yarn release:${{github.event.inputs.versionType}}

.github/workflows/version-bump.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: version-bump
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
versionType:
7+
type: choice
8+
description: 'Version type to bump'
9+
options:
10+
- latest
11+
- next
12+
required: true
13+
default: "latest"
14+
15+
jobs:
16+
version-bump:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Setup node
25+
uses: actions/setup-node@v4
26+
with:
27+
always-auth: true
28+
node-version: 20
29+
cache: 'yarn'
30+
scope: '@lingui'
31+
32+
- name: Install dependencies if needed
33+
run: yarn install
34+
35+
- name: Build packages
36+
run: yarn release:build
37+
38+
- name: Unit Testing
39+
run: yarn test:ci
40+
41+
- name: Linting & Types
42+
run: yarn lint:all
43+
44+
- name: Prepare Lingui-Bot git account
45+
uses: oleksiyrudenko/gha-git-credentials@v2-latest
46+
with:
47+
name: 'Lingui Bot'
48+
49+
actor: 'lingui-bot'
50+
token: '${{ secrets.GH_TOKEN }}'
51+
52+
- name: Versioning packages
53+
env:
54+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
55+
run: yarn version:${{github.event.inputs.versionType}}

0 commit comments

Comments
 (0)