-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (90 loc) · 3.05 KB
/
tfx-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
name: TFX Extension
on:
push:
branches: [main]
tags: ['*']
jobs:
build:
name: Build extension
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history so that GitVersion can calculate the version
- name: Use GitVersion 6.x
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: Update version numbers in vss-extension.overrides.json
uses: cschleiden/replace-tokens@v1
with:
files: '["vss-extension.overrides.*.json"]'
env:
MAJOR_MINOR_PATCH: ${{ steps.gitversion.outputs.majorMinorPatch }}
BUILD_NUMBER: ${{ github.run_number }}
- name: Update version numbers in task.json
run: |
echo "`jq '.version.Major=${{ steps.gitversion.outputs.major }}' task/task.json`" > task/task.json
echo "`jq '.version.Minor=${{ steps.gitversion.outputs.minor }}' task/task.json`" > task/task.json
echo "`jq '.version.Patch=${{ github.run_number }}' task/task.json`" > task/task.json
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: '18.x'
- name: NPM Install
run: npm install
- name: Build extension
run: npm run build
- name: Package extension (dev)
run: npm run package:dev
- name: Package extension (prod)
run: npm run package:prod
- name: Upload artifact (drop)
uses: actions/upload-artifact@v4
with:
path: ${{ github.workspace }}/dist/*
name: drop
publish:
name: Publish extension
runs-on: ubuntu-latest
needs: [build]
permissions:
contents: write
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: Publish to marketplace (dev)
if: github.ref == 'refs/heads/main'
run: >
npx tfx-cli extension publish
--vsix ${{ github.workspace }}/dev/*.vsix
--auth-type pat
--token ${{ secrets.AZURE_DEVOPS_EXTENSION_TOKEN }}
--share-with rhyskoedijk
- name: Publish to marketplace (prod)
if: startsWith(github.ref, 'refs/tags/')
run: >
npx tfx-cli extension publish
--vsix ${{ github.workspace }}/prod/*.vsix
--auth-type pat
--token ${{ secrets.AZURE_DEVOPS_EXTENSION_TOKEN }}