-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (53 loc) · 2 KB
/
release.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
name: release
on:
workflow_dispatch:
inputs:
version:
type: string
description: The version to use for the release.
default: ''
dry-run:
type: boolean
default: true
push:
branches:
- 'main'
jobs:
main:
# Kind of unnessecary because nx release will add `[skip ci]` in the commit message, but safe is safe
if: "${{ github.event_name == 'workflow_dispatch' || !startsWith(github.event.head_commit.message, 'chore: release') }}"
runs-on: ubuntu-latest
steps:
# Observation:
# We cannot use `GITHHUB_TOKEN` since it cannot bypass protected branches.
# Rule definition: https://github.com/RobbyRabbitman/nx-plus/settings/rules/1073339
#
# Solution:
# So we installed a Github App which requests permissions to 'contents' of this repo
# The App is listed in the bypass list
- uses: actions/create-github-app-token@v1
id: create-release-app-token
with:
app-id: ${{ vars.RELEASE_APP_ID }}
private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
- uses: actions/checkout@v4
with:
token: ${{ steps.create-release-app-token.outputs.token }}
fetch-depth: 0
- run: |
git config user.email "[email protected]"
git config user.name "release"
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: 'pnpm'
cache-dependency-path: 'pnpm-lock.yaml'
- run: pnpm i
- run: pnpm exec nx report
- run: pnpm exec nx release --skip-publish --dry-run=${{ env.DRY_RUN }} ${{ env.VERSION }}
env:
GITHUB_TOKEN: ${{ steps.create-release-app-token.outputs.token }}
DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && inputs.dry-run }}
VERSION: ${{ github.event_name == 'push' && '' || inputs.version }}
NX_VERBOSE_LOGGING: ${{ runner.debug && true || false }}