Support .azuredevops folder alongside .github #607
Workflow file for this run
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 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Required for GitVersion | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/setup@v0 | |
with: | |
versionSpec: '5.x' | |
- name: Determine Version | |
id: gitversion | |
uses: gittools/actions/gitversion/execute@v0 | |
with: | |
useConfigFile: true | |
- name: Use Node.js 18.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18.x' | |
- 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:prod | |
working-directory: '${{ github.workspace }}/extension' | |
- name: Move node_modules | |
run: npm run mv:prod | |
working-directory: '${{ github.workspace }}/extension' | |
- name: Install tfx-cli | |
run: npm install -g [email protected] | |
- name: Replace tokens | |
uses: cschleiden/replace-tokens@v1 | |
with: | |
files: '["${{ github.workspace }}/extension/overrides*.json"]' | |
- name: Update values in extension/task/task.json | |
run: | | |
echo "`jq '.version.Major=${{ steps.gitversion.outputs.major }}' extension/task/task.json`" > extension/task/task.json | |
echo "`jq '.version.Minor=${{ steps.gitversion.outputs.minor }}' extension/task/task.json`" > extension/task/task.json | |
echo "`jq '.version.Patch=${{ github.run_number }}' extension/task/task.json`" > extension/task/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: Publish Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
path: ${{ github.workspace }}/drop/* | |
name: drop | |
Publish: | |
runs-on: ubuntu-latest | |
needs: [ Build ] | |
steps: | |
- name: Download Artifact | |
uses: actions/download-artifact@v3 | |
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 }} |