-
Notifications
You must be signed in to change notification settings - Fork 6
149 lines (121 loc) · 4.21 KB
/
deploy.yaml
File metadata and controls
149 lines (121 loc) · 4.21 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: Build and deploy extension
on:
workflow_dispatch:
inputs:
publish:
description: Whether to publish to marketplaces.
type: boolean
default: true
bump_version:
description: Whether to increment the version number before publishing.
type: boolean
default: true
new_version:
description: The new version, passed to the `npm version` command. Has no effect if bump_version is off.
type: choice
required: true
options:
- major
- minor
- patch
pre_release:
description: Whether to release as a pre-release version.
type: boolean
default: false
create_release:
description: Whether to create a GitHub release.
type: boolean
default: false
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read # set a default which is overruled at job level
jobs:
version:
name: Increment version
runs-on: ubuntu-latest
permissions:
contents: write # Required for version bumps
defaults:
run:
shell: bash
outputs:
version: ${{ steps.bump.outputs.version }}
commit_sha: ${{ steps.get_sha.outputs.sha }}
steps:
- name: Setup Node
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a
with:
node-version: 20
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
token: ${{ secrets.RELEASE_BOT_TOKEN }}
- name: Configure Git
run: |
git config --global user.name 'Release Bot'
git config --global user.email 'modularbot@modular.com'
- name: Bump version
if: ${{ inputs.bump_version }}
run: npm version ${{ inputs.new_version }}
- name: Push version bump
if: ${{ inputs.bump_version }}
run: git push
- name: Extract package version
id: bump
run: |
export VERSION=$(jq -r '.version' package.json)
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Get new commit SHA
id: get_sha
run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
build:
needs: [version]
uses: ./.github/workflows/build.yaml
with:
ref: ${{ needs.version.outputs.commit_sha || github.sha }}
publish:
name: Publish extension
runs-on: ubuntu-latest
needs: [version, build]
permissions:
contents: write # Needed to create GitHub releases
defaults:
run:
shell: bash
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
ref: ${{ needs.version.outputs.commit_sha || github.sha }}
- uses: ./.github/actions/setup
- name: Download built VSIX
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0
id: download
with:
name: ${{ needs.build.outputs.artifact-id }}
- name: Enable pre-release builds
if: ${{ inputs.pre_release }}
run: |
echo "PUBLISH_FLAGS=--pre-release" >> "$GITHUB_ENV"
- name: Upload extension to VS Code marketplace
if: ${{ inputs.publish }}
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
run: npx vsce publish $PUBLISH_FLAGS --packagePath "${{ steps.download.outputs.download-path }}/vscode-mojo.vsix" --skip-duplicate
- name: Upload extension to Open-VSX marketplace
if: ${{ inputs.publish }}
env:
OVSX_PAT: ${{ secrets.OVSX_PAT }}
run: npx ovsx publish $PUBLISH_FLAGS --packagePath "${{ steps.download.outputs.download-path }}/vscode-mojo.vsix" --skip-duplicate
- name: Create release
if: ${{ inputs.create_release }}
uses: softprops/action-gh-release@72f2c25fcb47643c292f7107632f7a47c1df5cd8
with:
draft: true
tag_name: v${{ needs.version.output.version }}
release_name: v${{ needs.version.output.version }}
token: ${{ github.token }}
files: ${{ steps.download.outputs.download-path }}
generate_release_notes: true