Change identifier for v2 task #911
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: 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 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Required for GitVersion | |
- name: Install GitVersion | |
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: Use Node.js 18.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18.x' | |
cache: npm | |
- name: Install (root) | |
run: npm install | |
- name: Format check (root) | |
run: npm run format:check | |
- 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 | |
working-directory: '${{ github.workspace }}/extension' | |
- name: Install tfx-cli | |
run: npm install -g [email protected] | |
- name: Update version numbers in vss-extension.json overrides files | |
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 version numbers in task.json | |
run: | | |
echo "`jq '.version.Major=1' extension/tasks/dependabotV1/task.json`" > extension/tasks/dependabotV1/task.json | |
echo "`jq '.version.Minor=34' extension/tasks/dependabotV1/task.json`" > extension/tasks/dependabotV1/task.json | |
echo "`jq '.version.Patch=${{ github.run_number }}' extension/tasks/dependabotV1/task.json`" > extension/tasks/dependabotV1/task.json | |
echo "`jq '.version.Major=${{ steps.gitversion.outputs.major }}' extension/tasks/dependabotV2/task.json`" > extension/tasks/dependabotV2/task.json | |
echo "`jq '.version.Minor=${{ steps.gitversion.outputs.minor }}' extension/tasks/dependabotV2/task.json`" > extension/tasks/dependabotV2/task.json | |
echo "`jq '.version.Patch=${{ github.run_number }}' extension/tasks/dependabotV2/task.json`" > extension/tasks/dependabotV2/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 }}-${{ github.ref }} | |
cancel-in-progress: false # wait for previous runs to complete | |
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 }} |