-
-
Notifications
You must be signed in to change notification settings - Fork 66
163 lines (137 loc) · 4.97 KB
/
extension.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
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: Extension
on:
push:
branches:
- main
tags:
- '*'
paths:
- 'extension/**'
- '.github/workflows/extension.yml'
- '!extension/README.md'
- '!docs/**'
pull_request:
branches:
# Only trigger for PRs against `main` branch.
- main
paths:
- 'extension/**'
- '.github/workflows/extension.yml'
- '!extension/README.md'
- '!docs/**'
jobs:
Build:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Required for GitVersion
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '6.x'
- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: true
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: '18.x'
cache: npm
- name: Install (root)
run: npm install
- name: Format check (root)
run: npm run format:check
- name: Install
run: npm install
working-directory: '${{ github.workspace }}/extension'
- name: Test
run: npm run test
working-directory: '${{ github.workspace }}/extension'
- name: Build
run: npm run build
working-directory: '${{ github.workspace }}/extension'
- name: Install tfx-cli
run: npm install -g [email protected]
- name: Update version numbers in vss-extension.json overrides files
uses: cschleiden/replace-tokens@v1
with:
files: '["${{ github.workspace }}/extension/overrides*.json"]'
env:
MAJOR_MINOR_PATCH: ${{ steps.gitversion.outputs.majorMinorPatch }}
BUILD_NUMBER: ${{ github.run_number }}
- name: Update minor and path versions in task.json
run: |
# Major versions are left out here because they are fixed in the task.json files.
# The minor and patch versions are updated to make sure we keep recent changes deployed.
echo "`jq '.version.Minor=${{ steps.gitversion.outputs.minor }}' extension/tasks/dependabotV1/task.json`" > extension/tasks/dependabotV1/task.json
echo "`jq '.version.Patch=${{ github.run_number }}' extension/tasks/dependabotV1/task.json`" > extension/tasks/dependabotV1/task.json
echo "`jq '.version.Minor=${{ steps.gitversion.outputs.minor }}' extension/tasks/dependabotV2/task.json`" > extension/tasks/dependabotV2/task.json
echo "`jq '.version.Patch=${{ github.run_number }}' extension/tasks/dependabotV2/task.json`" > extension/tasks/dependabotV2/task.json
- name: Create Extension (dev)
run: >
tfx extension create
--root extension
--manifest-globs vss-extension.json
--output-path ${{ github.workspace }}/drop/dev
--json5
--overrides-file ${{ github.workspace }}/extension/overrides.dev.json
- name: Create Extension (prod)
run: >
tfx extension create
--root extension
--manifest-globs vss-extension.json
--output-path ${{ github.workspace }}/drop/prod
--json5
--overrides-file ${{ github.workspace }}/extension/overrides.prod.json
- name: Upload Artifact (drop)
uses: actions/upload-artifact@v4
with:
path: ${{ github.workspace }}/drop/*
name: drop
Publish:
runs-on: ubuntu-latest
needs: [Build]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false # wait for previous runs to complete
steps:
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: drop
- name: Upload Release
if: startsWith(github.ref, 'refs/tags/')
uses: ncipollo/release-action@v1
with:
artifacts: '${{ github.workspace }}/prod/*.vsix,${{ github.workspace }}/dev/*.vsix'
token: ${{ secrets.GITHUB_TOKEN }}
draft: true
allowUpdates: true
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: '18.x'
- name: Install tfx-cli
run: npm install -g [email protected]
- name: Publish to marketplace (dev)
if: github.ref == 'refs/heads/main'
run: >
tfx extension publish
--vsix ${{ github.workspace }}/dev/*.vsix
--auth-type pat
--token ${{ secrets.AZURE_DEVOPS_EXTENSION_TOKEN }}
--share-with tingle rhyskoedijk
- name: Publish to marketplace (prod)
if: startsWith(github.ref, 'refs/tags/')
run: >
tfx extension publish
--vsix ${{ github.workspace }}/prod/*.vsix
--auth-type pat
--token ${{ secrets.AZURE_DEVOPS_EXTENSION_TOKEN }}