Release Extension #130
This file contains hidden or 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 ${{ github.ref_name }} | |
| git push origin ${{ github.ref_name }} --tags | |
| - name: Create release | |
| id: create_release | |
| shell: bash | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: gh release create ${{ needs.build-project.outputs.version }} --generate-notes $(find . -name '*.vsix') | |
| - name: Publish 2022 extension to Marketplace | |
| uses: cezarypiatek/VsixPublisherAction@0.2 | |
| 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 }} |