-
-
Notifications
You must be signed in to change notification settings - Fork 103
108 lines (91 loc) · 3.01 KB
/
build-version-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
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: ' 🚀 Publish: 1. Create Version Release'
on:
workflow_dispatch:
inputs:
bump:
description: 'Version Bump'
type: choice
options:
- 'patch'
- 'minor'
- 'major'
- 'auto'
default: 'auto'
required: true
prerelease:
type: boolean
description: Prerelease
dry_run:
description: 'Dry Run'
type: boolean
default: true
workflow_call:
secrets:
token:
required: true
permissions:
contents: read
env:
USE_NEXT: ${{ inputs.prerelease }}
BUMP: ${{ (inputs.bump != 'auto' && inputs.prerelease && 'pre') || '' }}${{ (inputs.bump != 'auto' && inputs.bump) || '' }}
DRY_RUN: ${{ (inputs.dry_run && '--dry-run') || '' }}
jobs:
release_version:
runs-on: ubuntu-latest
steps:
- name: Show Inputs
env:
INPUTS: ${{ toJSON(inputs) }}
run: |
echo "$INPUTS"
echo USE_NEXT: "$USE_NEXT"
echo BUMP: "$BUMP"
echo DRY_RUN: "$DRY_RUN"
- uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
# cspell:ignore tibdex
if: ${{ !env.DRY_RUN && !inputs.token }}
id: generate-token
with:
app_id: ${{ secrets.AUTOMATION_APP_ID }}
private_key: ${{ secrets.AUTOMATION_PRIVATE_KEY }}
- name: Setup Token
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token || secrets.GITHUB_TOKEN }}
run: echo GITHUB_TOKEN=$GITHUB_TOKEN >> $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ env.GITHUB_TOKEN }} # needed to trigger workflows
- name: Setup pnpm
uses: pnpm/[email protected]
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
cache: pnpm
- name: Version
run: |
echo VERSION=$(jq -r .version lerna.json) >> $GITHUB_ENV
- name: Mode
env:
MODE: >
${{ (env.USE_NEXT == 'true' && '"--conventional-prerelease=*"')
|| (contains(env.VERSION, 'alpha') && '"--conventional-graduate=*"')
|| ''
}}
run: |
echo MODE=$MODE >> $GITHUB_ENV
- name: Setup Git
run: |
git config user.name streetsidesoftware[bot]
git config user.email streetsidesoftware[bot]@users.noreply.github.com
git remote add gh-token "https://${{ env.GITHUB_TOKEN }}@github.com/streetsidesoftware/cspell.git"
- name: Install
run: pnpm i
# - name: Debug
# run: |
# pnpx envinfo --system --npmPackages '@lerna-lite/*' --binaries --browsers
- name: Push Version
run: pnpm lerna version ${{ env.BUMP }} --conventional-commits --sync-workspace-lock --changelog-preset conventionalcommits --yes ${{ env.MODE }} ${{ env.DRY_RUN }}
# cspell:ignore pnpx envinfo conventionalcommits