-
-
Notifications
You must be signed in to change notification settings - Fork 4
131 lines (120 loc) · 4.27 KB
/
release.yml
File metadata and controls
131 lines (120 loc) · 4.27 KB
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Manual Publish
run-name: Manual Publish - ${{ github.event.inputs.releaseType }}${{ github.event.inputs.dryRun == 'yes' && ' (DRY RUN)' || '' }}
on:
workflow_dispatch:
inputs:
releaseType:
description: 'Release Type'
required: true
type: choice
default: 'patch'
options:
- patch
- minor
- major
- prepatch
- preminor
- premajor
- prerelease
publishMarketplace:
description: 'Publish on Visual Studio Marketplace?'
required: true
type: choice
default: 'yes'
options:
- 'yes'
- 'no'
force-bump:
description: 'Skip the lerna changed check? (If "yes", `lerna version` will be executed with `--force-publish`)'
required: true
type: choice
default: 'no'
options:
- 'yes'
- 'no'
dryRun:
description: 'Dry run? If yes, this workflow will NOT push to remote and NOT publish the extension.'
required: true
type: choice
default: 'yes'
options:
- 'yes'
- 'no'
env:
TURBO_TELEMETRY_DISABLED: 1
jobs:
release:
permissions:
contents: write
id-token: write
runs-on: ubuntu-latest
steps:
- name: 👷 Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: 'main'
fetch-depth: 0
- name: 🛠️ Setup workspace
uses: ./.github/actions/setup-workspace
with:
node-version: '20'
- name: 🪄 Generate Prerelease patch version number
id: gen-pre-release-ver
env:
RELEASE_TYPE: ${{ github.event.inputs.releaseType }}
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
result-encoding: string
script: |
const releaseType = process.env.RELEASE_TYPE;
const isPreRelease = releaseType.startsWith('pre')
const version = isPreRelease ? String(Math.floor(Date.now() / 1000)) : '';
if (isPreRelease) {
core.info(`Pre-release patch version number: ${version}`)
} else {
core.info(`This is not pre-release: ${version}`)
}
return version
- name: 🚧 Bump the version
id: bump
run: >
pnpm lerna version
${{ github.event.inputs.releaseType }}
${{ github.event.inputs.force-bump == 'yes' && '--force-publish' || '' }}
--no-push --exact --preid next --yes -m "chore(release): %s"
env:
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}
VSCODE_WDIO_PRE_RELEASE_PATCH_NUMBER: ${{ steps.gen-pre-release-ver.outputs.result }}
- name: 🛫 Build and publish as pre-release
if: ${{ github.event.inputs.publishMarketplace == 'yes' && startsWith(github.event.inputs.releaseType, 'pre') }}
run: |
pnpm run publish:next
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}
VSCODE_WDIO_DRY_RUN: ${{ github.event.inputs.dryRun }}
VSCODE_WDIO_PRE_RELEASE_PATCH_NUMBER: ${{ steps.gen-pre-release-ver.outputs.result }}
- name: 🚀 Build and publish
if: ${{ github.event.inputs.publishMarketplace == 'yes' && !startsWith(github.event.inputs.releaseType, 'pre') }}
run: |
pnpm run publish
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}
VSCODE_WDIO_DRY_RUN: ${{ github.event.inputs.dryRun }}
- name: ✅ Push to remote repository
env:
IS_DRY_RUN: ${{ github.event.inputs.dryRun }}
run: |
if [ "${IS_DRY_RUN}" = "yes" ]; then
git push origin --no-verify --follow-tags --dry-run
else
git push origin --no-verify --follow-tags
fi
- name: 📝 Create the Github Release
run: |
pnpm --filter @vscode-wdio/release run release-note
env:
GITHUB_AUTH: ${{ secrets.WDIO_BOT_GITHUB_TOKEN }}
VSCODE_WDIO_DRY_RUN: ${{ github.event.inputs.dryRun }}
VSCODE_WDIO_RELEASE_NOTE: ${{ steps.bump.outputs.changelog }}