Skip to content

Commit bb7af14

Browse files
authored
ci: create new release-it-without-pr-only.yml (#5)
1 parent 77ca5eb commit bb7af14

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

.github/workflows/release-it-with-pr-only.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ jobs:
3737
needs: [build, lint]
3838

3939
steps:
40+
# (1) Create a GitHub App token
41+
# Note: the Github App must be installed on the repository and included in the bypass list of the ruleset.
4042
- uses: actions/create-github-app-token@v1
4143
id: app-token
4244
with:
@@ -46,12 +48,15 @@ jobs:
4648
- name: Checkout
4749
uses: actions/checkout@v4
4850
with:
51+
# (2) Use the GitHub App token to init the repository
4952
token: ${{ steps.app-token.outputs.token }}
53+
# (3) Fetch all history so that release-it can determine the version
5054
fetch-depth: 0
5155

5256
- name: Setup
5357
uses: ./.github/actions/setup
5458

59+
# (3) Configure Git user
5560
- name: Configure Git User
5661
run: |
5762
git config --global user.name "${GITHUB_ACTOR}"
@@ -60,5 +65,6 @@ jobs:
6065
- name: Release
6166
run: yarn release
6267
env:
68+
# (4) Make GITHUB_TOKEN available to release-it but use the GitHub App token
6369
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
6470

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: release
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
build:
7+
name: Build
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4
13+
14+
- name: Setup
15+
uses: ./.github/actions/setup
16+
17+
- name: Build
18+
run: yarn build
19+
20+
lint:
21+
name: Lint
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
- name: Setup
29+
uses: ./.github/actions/setup
30+
31+
- name: Lint
32+
run: yarn lint
33+
34+
release:
35+
name: Release
36+
runs-on: ubuntu-latest
37+
needs: [build, lint]
38+
39+
# (1) Configure GITHUB_TOKEN with write permissions
40+
permissions:
41+
contents: write
42+
43+
steps:
44+
- name: Checkout
45+
uses: actions/checkout@v4
46+
with:
47+
# (2) Fetch all history so that release-it can determine the version
48+
fetch-depth: 0
49+
50+
- name: Setup
51+
uses: ./.github/actions/setup
52+
53+
# (3) Configure Git user
54+
- name: Configure Git User
55+
run: |
56+
git config --global user.name "${GITHUB_ACTOR}"
57+
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
58+
59+
- name: Release
60+
run: yarn release
61+
env:
62+
# (4) Make GITHUB_TOKEN available to release-it
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+

0 commit comments

Comments
 (0)