From 4bceee4d70af66c21eea3a87f50a3ab176af158e Mon Sep 17 00:00:00 2001 From: esarver Date: Mon, 1 Apr 2024 11:35:22 -0400 Subject: [PATCH] Update CI to Handle No `dev` Branch (#9) * Update CI to handle eliminated dev branch. * Bump version number * remove replaced code * Update Changelog to make parser happy * fix versioning code --- .github/workflows/pr.yml | 29 ++++++++++++++++++++++++----- .github/workflows/veracode.yml | 2 +- CHANGELOG.md | 8 +++++++- package-lock.json | 6 +++--- package.json | 2 +- 5 files changed, 36 insertions(+), 11 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 44b6a34..ce5bf9b 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -145,7 +145,7 @@ jobs: - sbom - lint - style - if: ${{ endsWith(github.base_ref, 'main') && contains(github.head_ref, 'release') }} + if: ${{ (endsWith(github.base_ref, 'main') && (contains(github.head_ref, 'release/')) || github.event.pull_request.merged ) }} steps: - name: Checkout uses: actions/checkout@v3 @@ -156,11 +156,29 @@ jobs: id: lasttag run: | COMMIT="${{github.sha}}" - V="${{github.head_ref}}" - V="${V#release/}" + if ${{contains(github.head_ref, 'release/')}}; then + V="${{github.head_ref}}" + V="${V#release/}" + else + V="$(npm pkg get version)" + echo "Extracted Version: $V" + V="$(echo v"$V" | sed 's/\"//g')" + echo "Cleaned up Version: $V" + fi + + # Check to see if the version tag already exists + # If it does, print a message and exit with an error code + if [ $(git tag --list "$V") ]; then + echo "Version tag already exists. Did you bump the version number?" + exit 1 + fi - if ${{! github.event.pull_request.merged}}; then + # Create an RC release if + # 1) This PR is a release branch that hasn't been merged to main. + # 2) This is a feature branch being merged into the main branch. + if ${{(! github.event.pull_request.merged && contains(github.head_ref, 'release/')) || (github.event.pull_request.merged && !contains(github.head_ref, 'release/'))}}; then V="${V}-$(git tag --list ${V}* | wc -l)" + echo "RC Version: $V" fi CL=${V#v} @@ -169,6 +187,7 @@ jobs: echo "version=${V}" >> $GITHUB_OUTPUT echo "cl_version=${CL}" >> $GITHUB_OUTPUT echo "commit=${COMMIT}" >> $GITHUB_OUTPUT + - run: 'git tag --list ${V}*' - name: Get Artifacts uses: actions/download-artifact@v3 @@ -203,7 +222,7 @@ jobs: ${{steps.changelog.outputs.description}} - prerelease: ${{! github.event.pull_request.merged}} + prerelease: ${{ (! github.event.pull_request.merged) || (github.event.pull_request.merged && ! contains(github.head_ref, 'release/')) }} commit: ${{steps.lasttag.outputs.commit}} makeLatest: true tag: ${{steps.lasttag.outputs.version}} diff --git a/.github/workflows/veracode.yml b/.github/workflows/veracode.yml index c2abd61..93629c6 100644 --- a/.github/workflows/veracode.yml +++ b/.github/workflows/veracode.yml @@ -3,7 +3,7 @@ name: Veracode Scan on: push: branches: - - dev + - main schedule: - cron: 0 0 * * sun workflow_dispatch: diff --git a/CHANGELOG.md b/CHANGELOG.md index c9bf350..4ac40c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,11 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how Security -- in case of vulnerabilities. --> +## [0.15.1] + +### Changed +- Nothing yet + ## [0.15.0] ### Fixed @@ -69,7 +74,8 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how - Feature to retrieve TSP-Link network details -[Unreleased]: https://github.com/tektronix/tsp-toolkit/compare/v0.15.0...HEAD +[Unreleased]: https://github.com/tektronix/tsp-toolkit/compare/v0.15.1...HEAD +[0.15.1]: https://github.com/tektronix/tsp-toolkit/releases/tag/v0.15.1 [0.15.0]: https://github.com/tektronix/tsp-toolkit/releases/tag/v0.15.0 [0.14.1]: https://github.com/tektronix/tsp-toolkit/releases/tag/v0.14.1 [0.13.2]: https://github.com/tektronix/tsp-toolkit/releases/tag/v0.13.2 diff --git a/package-lock.json b/package-lock.json index 8cd1feb..fed0f79 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "tsp-toolkit", - "version": "0.15.0", + "version": "0.15.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "tsp-toolkit", - "version": "0.15.0", + "version": "0.15.1", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { @@ -30,7 +30,7 @@ "@types/mocha": "^9.1.1", "@types/node": "^14.18.63", "@types/node-fetch": "^2.6.11", - "@types/vscode": "^1.87.0", + "@types/vscode": "^1.75.0", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", "@vscode/vsce": "^2.24.0", diff --git a/package.json b/package.json index 950f884..ce2543c 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "publisher": "Tektronix", "displayName": "[Beta] Keithley TSP Toolkit", "description": "VSCode extension for Keithley Instruments' Test Script Protocol", - "version": "0.15.0", + "version": "0.15.1", "icon": "./resources/TSP_Toolkit_128x128.png", "galleryBanner": { "color": "#EEEEEE",