-
Notifications
You must be signed in to change notification settings - Fork 40
115 lines (94 loc) · 3.5 KB
/
main.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
name: Build and Deploy
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'
- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: true
configFilePath: 'git-version.yml'
- name: Npm install
run: npm install
- name: Tfx install
run: npm install -g tfx-cli
- name: Update task.json version - Major
uses: jossef/action-set-json-field@v2
with:
file: ./src/task.json
field: version.Major
value: ${{ steps.gitversion.outputs.major }}
- name: Update task.json version - Minor
uses: jossef/action-set-json-field@v2
with:
file: src/task.json
field: version.Minor
value: ${{ steps.gitversion.outputs.minor }}
- name: Update task.json version - Patch
uses: jossef/action-set-json-field@v2
with:
file: src/task.json
field: version.Patch
value: ${{ steps.gitversion.outputs.commitsSinceVersionSource }}
- name: Npm compile
run: npm run compile
- name: Tfx Package Test
run: "tfx extension create --manifest-globs vss-extension.json --overrides-file configs/test.json --override '{\"version\": \"${{ steps.gitversion.outputs.major }}.${{ steps.gitversion.outputs.minor }}.${{ steps.gitversion.outputs.commitsSinceVersionSource }}.${{ github.run_number }}\"}' --output-path out"
- name: Tfx Package Prod
if: github.ref == 'refs/heads/main'
run: "tfx extension create --manifest-globs vss-extension.json --overrides-file configs/release.json --override '{\"version\": \"${{ steps.gitversion.outputs.major }}.${{ steps.gitversion.outputs.minor }}.${{ steps.gitversion.outputs.commitsSinceVersionSource }}\"}' --output-path out"
- name: Upload Tfx Package
uses: actions/[email protected]
with:
name: tfxpackage
path: ./out/
deployment_test:
if: github.ref == 'refs/heads/main'
needs: [build]
runs-on: ubuntu-latest
environment: test
steps:
- name: Download Tfx Package
uses: actions/[email protected]
with:
name: tfxpackage
- name: Tfx install
run: npm install -g tfx-cli
- name: Tfx Package
env:
AZURE_DEVOPS_PAT: ${{ secrets.AZURE_DEVOPS_PAT }}
run: |
filename=$(ls bluebasher.bluebasher-workitemupdater-testing-*.vsix)
tfx extension publish --vsix $filename --auth-type pat --token $AZURE_DEVOPS_PAT
deployment_production:
if: github.ref == 'refs/heads/main'
needs: [deployment_test]
runs-on: ubuntu-latest
environment: production
steps:
- name: Download Tfx Package
uses: actions/[email protected]
with:
name: tfxpackage
- name: Tfx install
run: npm install -g tfx-cli
- name: Tfx Package
env:
AZURE_DEVOPS_PAT: ${{ secrets.AZURE_DEVOPS_PAT }}
run: |
filename=$(ls bluebasher.bluebasher-workitemupdater-*.vsix)
tfx extension publish --vsix $filename --auth-type pat --token $AZURE_DEVOPS_PAT