Use node 20.1 #93
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/setup@v3 | |
with: | |
versionSpec: '6.0.x' | |
- name: Determine version | |
id: gitversion | |
uses: gittools/actions/gitversion/execute@v3 | |
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 20.1.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.1.x' | |
- name: NPM Install | |
run: npm install | |
- name: Build extension | |
run: npm run build | |
- name: Run unit tests | |
run: npm test | |
- 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 20.1.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.1.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 }} |