-
-
Notifications
You must be signed in to change notification settings - Fork 66
152 lines (128 loc) · 4.08 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
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
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Required for GitVersion
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0
with:
versionSpec: '5.x'
- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/execute@v0
with:
useConfigFile: true
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: '18.x'
- 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:prod
working-directory: '${{ github.workspace }}/extension'
- name: Move node_modules
run: npm run mv:prod
working-directory: '${{ github.workspace }}/extension'
- name: Install tfx-cli
run: npm install -g [email protected]
- name: Replace tokens
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 values in extension/task/task.json
run: |
echo "`jq '.version.Major=${{ steps.gitversion.outputs.major }}' extension/task/task.json`" > extension/task/task.json
echo "`jq '.version.Minor=${{ steps.gitversion.outputs.minor }}' extension/task/task.json`" > extension/task/task.json
echo "`jq '.version.Patch=${{ github.run_number }}' extension/task/task.json`" > extension/task/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 }}
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
- 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 }}