93 lines (79 loc) · 2.53 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
name: " 🚀 Create Version Release"
on:
workflow_dispatch:
inputs:
bump:
description: "Version Bump"
type: choice
options:
- "alpha"
- "patch"
- "minor"
- "auto"
default: "auto"
required: true
dry_run:
description: "Dry Run"
type: choice
options:
- "yes"
- "no"
default: "yes"
required: false
workflow_call:
secrets:
token:
required: true
permissions:
contents: read
env:
USE_NEXT: ${{ inputs.bump == 'alpha' }}
BUMP: ${{ (inputs.bump != 'auto' && inputs.bump != 'alpha' && inputs.bump) || '' }}
DRY_RUN: ${{ (inputs.dry_run == 'yes' && '--git-dry-run') || '' }}
jobs:
release_version:
runs-on: ubuntu-latest
steps:
- uses: tibdex/github-app-token@021a2405c7f990db57f5eae5397423dcc554159c # v1.5 # 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@v3
with:
token: ${{ env.GITHUB_TOKEN }} # needed to trigger workflows
- name: Setup pnpm
uses: pnpm/action-setup@v2.2.4
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16
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: Push Version
run: pnpm lerna version --conventional-commits --sync-workspace-lock --yes ${{ env.MODE }} ${{ env.DRY_RUN }} ${{ env.BUMP }}