-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (77 loc) · 2.38 KB
/
release-it-with-npm-and-pr-only-and-inputs.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
85
86
87
88
89
90
91
92
93
94
name: release-it-with-npm-and-pr-only-and-inputs
on:
workflow_dispatch:
inputs:
dry-run:
description: 'Run release-it in dry-run mode'
required: false
default: false
type: boolean
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/setup
- name: Build
run: yarn build
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
name: build-artifact
path: build
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/setup
- name: Lint
run: yarn lint
release:
name: Release
runs-on: ubuntu-latest
needs: [build, lint]
steps:
# (1) Create a GitHub App token
# Note: the Github App must be installed on the repository and included in the bypass list of the ruleset.
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.PRIVATE_KEY }}
- name: Checkout
uses: actions/checkout@v4
with:
# (2) Use the GitHub App token to init the repository
token: ${{ steps.app-token.outputs.token }}
# (3) Fetch all history so that release-it can determine the version
fetch-depth: 0
- name: Setup
uses: ./.github/actions/setup
# (4) Configure Git user
- name: Configure Git User
run: |
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Download Build Artifact
uses: actions/download-artifact@v4
with:
name: build-artifact
- name: Release
run: |
if [ ${{ inputs.dry-run }} = true ]; then
yarn release-it --dry-run
else
yarn release-it
fi
env:
# (5) Make GITHUB_TOKEN available to release-it but use the GitHub App token
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
# (6) Make NPM_ACCESS_TOKEN available to release-it and npm publish command
NPM_ACCESS_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}