-
Notifications
You must be signed in to change notification settings - Fork 0
125 lines (102 loc) · 3.68 KB
/
build-tfx.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
name: Build
env:
TFX_VERSION: "0.16.0"
on:
push:
branches:
- main
tags:
- '*'
paths:
- "src/**"
- ".github/workflows/build-tfx.yml"
- "!LICENSE"
- "!README.md"
- "!docs/**"
jobs:
Build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: '18.x'
- name: Version Artifact
run: |
# Update task patch number to match build number
echo "`jq '.version.Patch=${{ github.run_number }}' src/task/task.json`" > src/task/task.json
# Current version from vss-extension manifest
current_version=$(jq -r '.version' src/vss-extension.json)
# Increment with build number as patch
IFS='.' read -ra version_parts <<< "$current_version"
version_parts[2]="${GITHUB_RUN_NUMBER:-0}"
updated_version=$(IFS='.'; echo "${version_parts[*]}")
# Update versions in overrides files
jq ".version |= \"0.$updated_version\"" src/overrides.dev.json > src/overrides.dev.json.tmp && mv src/overrides.dev.json.tmp src/overrides.dev.json
jq ".version |= \"$updated_version\"" src/overrides.prod.json > src/overrides.prod.json.tmp && mv src/overrides.prod.json.tmp src/overrides.prod.json
echo -e "New versions are ->\n\tDev: 0.$updated_version\n\tProd: $updated_version"
- name: Install
run: npm install
working-directory: '${{ github.workspace }}/src'
- name: Build
run: npm run build
working-directory: '${{ github.workspace }}/src'
- name: Install tfx-cli
run: npm i -g tfx-cli@$TFX_VERSION
- name: Update task files
run: |
cp $GITHUB_WORKSPACE/README.md $GITHUB_WORKSPACE/src/README.md
cp $GITHUB_WORKSPACE/LICENSE $GITHUB_WORKSPACE/src/LICENSE.md
- name: Package (Dev)
run: >
tfx extension create
--root src
--manifest-globs vss-extension.json
--output-path $GITHUB_WORKSPACE/builds/dev
--overrides-file $GITHUB_WORKSPACE/src/overrides.dev.json
- name: Package (Prod)
run: >
tfx extension create
--root src
--manifest-globs vss-extension.json
--output-path $GITHUB_WORKSPACE/builds/prod
--overrides-file $GITHUB_WORKSPACE/src/overrides.prod.json
- name: Publish Artifact
uses: actions/upload-artifact@v4
with:
path: ${{ github.workspace }}/builds/*
name: dependabot-fail-task
Publish:
runs-on: ubuntu-latest
needs: [ Build ]
steps:
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: '18.x'
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: dependabot-fail-task
- name: Install tfx-cli
run: npm i -g tfx-cli@$TFX_VERSION
# Docs: https://learn.microsoft.com/en-us/azure/devops/extend/publish/command-line?view=azure-devops
- name: Publish (Dev)
if: github.ref == 'refs/heads/main'
run: >
tfx extension publish
--vsix $GITHUB_WORKSPACE/dev/*.vsix
--auth-type pat
--token ${{ secrets.AZURE_DEVOPS_PAT }}
--share-with robyn-zip-testing
- name: Publish (Prod)
if: startsWith(github.ref, 'refs/tags/')
run: >
tfx extension publish
--vsix $GITHUB_WORKSPACE/prod/*.vsix
--auth-type pat
--token ${{ secrets.AZURE_DEVOPS_PAT }}