-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
09f7f5a
commit d929e95
Showing
10 changed files
with
170 additions
and
23 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Prettier | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
prettier: | ||
name: Check for formatting issues | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Use Node.js 18.x | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '18.x' | ||
|
||
- name: NPM Install | ||
run: npm install | ||
|
||
- name: NPM Format Check | ||
run: npm run format:check |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
name: Publish | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
tags: ['*'] | ||
|
||
jobs: | ||
build: | ||
name: Publish 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/[email protected] | ||
with: | ||
versionSpec: '6.x' | ||
|
||
- name: Determine version | ||
id: gitversion | ||
uses: gittools/actions/gitversion/[email protected] | ||
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 18.x | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '18.x' | ||
|
||
- name: NPM Install | ||
run: npm install | ||
|
||
- name: Build extension | ||
run: npm run build | ||
|
||
- 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: | ||
runs-on: ubuntu-latest | ||
needs: [build] | ||
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: 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: > | ||
tfx extension publish | ||
--vsix ${{ github.workspace }}/prod/*.vsix | ||
--auth-type pat | ||
--token ${{ secrets.AZURE_DEVOPS_EXTENSION_TOKEN }} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -218,4 +218,4 @@ | |
"target": "index.js" | ||
} | ||
} | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
{ | ||
"publisher": "rhyskoedijk", | ||
"id": "sbom-tool-dev", | ||
"name": "SBOM Tool [DEV]", | ||
"version": "1.0.0", | ||
"baseUri": "https://localhost:3000/", | ||
"public": false | ||
"version": "#{MAJOR_MINOR_PATCH}#.#{BUILD_NUMBER}#", | ||
"public": false, | ||
"baseUri": null | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
{ | ||
"publisher": "rhyskoedijk", | ||
"version": "1.0.0", | ||
"public": true | ||
"id": "sbom-tool", | ||
"name": "SBOM Tool", | ||
"version": "#{MAJOR_MINOR_PATCH}#.#{BUILD_NUMBER}#", | ||
"public": true, | ||
"baseUri": null | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
function incrementPatchVersion(vssExtensionJsonPath, taskJsonPath) { | ||
const vssExtensionJson = JSON.parse(fs.readFileSync(vssExtensionJsonPath)); | ||
const taskJson = JSON.parse(fs.readFileSync(taskJsonPath)); | ||
const version = taskJson.version || { Major: 1, Minor: 0, Patch: 0 }; | ||
version.Patch += 1; | ||
if (taskJson) { | ||
taskJson.version = version; | ||
fs.writeFileSync(taskJsonPath, JSON.stringify(taskJson, null, 2)); | ||
} | ||
if (vssExtensionJson) { | ||
vssExtensionJson.version = taskJson.version.Major + '.' + taskJson.version.Minor + '.' + taskJson.version.Patch; | ||
fs.writeFileSync(vssExtensionJsonPath, JSON.stringify(vssExtensionJson, null, 2)); | ||
} | ||
} | ||
|
||
incrementPatchVersion(path.join(__dirname, 'vss-extension.json'), path.join(__dirname, 'task', 'task.json')); |