Release Extension #119
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: Release Extension | |
on: | |
workflow_dispatch: | |
inputs: | |
incrementLevel: | |
description: 'Version level to increment' | |
required: true | |
type: choice | |
options: | |
- incrementPatch | |
- incrementMinor | |
- incrementMajor | |
default: incrementPatch | |
env: | |
SOLUTION_FILE_PATH: . | |
DEFAULT_BRANCH: main | |
jobs: | |
build-project: | |
uses: snyk/snyk-visual-studio-plugin/.github/workflows/build-project.yml@main | |
with: | |
solution-file-path: . | |
channel: stable | |
incrementLevel: ${{ inputs.incrementLevel }} | |
secrets: inherit | |
run-integration-tests: | |
needs: build-project | |
uses: snyk/snyk-visual-studio-plugin/.github/workflows/integration-tests.yml@main | |
secrets: inherit | |
run-unit-tests: | |
needs: build-project | |
name: Run Unit-Tests | |
runs-on: windows-2022 | |
defaults: | |
run: | |
working-directory: ${{ github.workspace }} | |
env: | |
TEST_API_TOKEN: ${{ secrets.TEST_API_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Download build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: build-artifacts | |
- name: Setup VSTest | |
uses: darenm/Setup-VSTest@v1 | |
- name: Tests | |
run: vstest.console.exe **\*.Tests.dll /TestCaseFilter:"FullyQualifiedName!=Xunit.Instances.VisualStudio&integration!=true" #exclude integration tests and the psuedo-tests that launch a VS instance | |
release: | |
needs: [build-project, run-integration-tests, run-unit-tests] | |
runs-on: windows-2022 | |
defaults: | |
run: | |
working-directory: ${{ github.workspace }} | |
environment: snyk-msbuild-envs | |
env: | |
VsixManifestPath: .\Snyk.VisualStudio.Extension.2022\source.extension.vsixmanifest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Download build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: build-artifacts | |
- name: Set up Git actions user | |
uses: fregante/setup-git-user@v1 | |
- name: Create and push Git tag release | |
run: | | |
git tag ${{ needs.build-project.outputs.version }} | |
git push origin main | |
git push origin main --tags | |
- name: Create GitHub Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ needs.build-project.outputs.version }} | |
release_name: Release ${{ needs.build-project.outputs.version }} | |
draft: false | |
prerelease: false | |
- name: Upload GitHub Release 2022 Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: .\Snyk.VisualStudio.Extension.2022\bin\Release\Snyk.VisualStudio.Extension.vsix | |
asset_name: Snyk_Vulnerability_Scanner-${{ needs.build-project.outputs.version }}-2022.vsix | |
asset_content_type: application/zip | |
- name: Publish 2022 extension to Marketplace | |
uses: cezarypiatek/[email protected] | |
with: | |
extension-file: '.\Snyk.VisualStudio.Extension.2022\bin\Release\Snyk.VisualStudio.Extension.vsix' | |
publish-manifest-file: '.\Snyk.VisualStudio.Extension.2022\vs-publish.json' | |
personal-access-code: ${{ secrets.VS_PUBLISHER_ACCESS_TOKEN }} |