fix issue #444 From https://learn.microsoft.com/en-us/visualstudio/in… #235
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: Push vsix artifact pull release and comment | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
types: [opened, synchronize, edited] | |
env: | |
CONFIGURATION: Release | |
VSIX_PROJECT: FineCodeCoverage | |
jobs: | |
push-vsix-artifact-pull-release-and-comment: | |
name: Push vsix artifact pull release and comment | |
runs-on: windows-2019 | |
steps: | |
- name: create variables | |
shell: bash | |
run: | | |
echo "SOLN=${{env.VSIX_PROJECT}}.sln" >> $GITHUB_ENV | |
echo "VSIX=${{github.workspace}}\${{env.VSIX_PROJECT}}\bin\${{env.CONFIGURATION}}\${{env.VSIX_PROJECT}}.vsix" >> $GITHUB_ENV # full path required for vsix publish | |
echo "VSIX2022=${{github.workspace}}\${{env.VSIX_PROJECT}}2022\bin\${{env.CONFIGURATION}}\${{env.VSIX_PROJECT}}2022.vsix" >> $GITHUB_ENV # full path required for vsix publish | |
- name: checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Determine next version | |
id: next-version | |
uses: paulhatch/[email protected] | |
with: | |
short_tags: false | |
branch: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || 'HEAD' }} | |
- name: set up msbuild | |
uses: microsoft/[email protected] | |
- name: set up VSTest | |
uses: darenm/Setup-VSTest@v1 | |
- name: nuget restore | |
run: nuget restore ${{env.SOLN}} | |
- name: Set version for Visual Studio Extension | |
uses: cezarypiatek/[email protected] | |
with: | |
version: ${{steps.next-version.outputs.major}}.${{steps.next-version.outputs.minor}}.${{steps.next-version.outputs.patch}} | |
vsix-manifest-file: ${{env.VSIX_PROJECT}}\source.extension.vsixmanifest | |
# want this ${{steps.next-version.outputs.major}}.${{steps.next-version.outputs.minor}}.${{github.run_number}}.${{steps.next-version.outputs.patch}} | |
# but https://github.com/FortuneN/FineCodeCoverage/issues/178 | |
- name: Set version for Visual Studio Extension 2022 | |
uses: cezarypiatek/[email protected] | |
with: | |
version: ${{steps.next-version.outputs.major}}.${{steps.next-version.outputs.minor}}.${{steps.next-version.outputs.patch}} | |
vsix-manifest-file: ${{env.VSIX_PROJECT}}2022\source.extension.vsixmanifest | |
# want this ${{steps.next-version.outputs.major}}.${{steps.next-version.outputs.minor}}.${{github.run_number}}.${{steps.next-version.outputs.patch}} | |
# but https://github.com/FortuneN/FineCodeCoverage/issues/178 | |
- name: build vsix | |
run: | | |
msbuild ${{env.SOLN}} /p:Configuration=${{env.CONFIGURATION}} /p:DeployExtension=False /verbosity:minimal | |
- name: vs test solution | |
uses: tonyhallett/[email protected] | |
# above are common steps for push and pull | |
# pull only | |
- name: upload vsix | |
if: github.event_name == 'pull_request' && !github.event.pull_request.draft | |
uses: actions/upload-artifact@v2 | |
with: | |
name: FineCodeCoverage ( zipped vsix) | |
path: ${{env.VSIX}} | |
- name: upload vsix 2022 | |
if: github.event_name == 'pull_request' && !github.event.pull_request.draft | |
uses: actions/upload-artifact@v2 | |
with: | |
name: FineCodeCoverage2022 ( zipped vsix) | |
path: ${{env.VSIX2022}} | |
# push only | |
- name: create release | |
if: github.event_name == 'push' | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{steps.next-version.outputs.version_tag}} | |
release_name: ${{steps.next-version.outputs.version_tag}} | |
draft: false | |
prerelease: falses | |
- name: Update release asset | |
if: github.event_name == 'push' | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{steps.create_release.outputs.upload_url}} | |
asset_path: ${{env.VSIX}} | |
asset_name: ${{env.VSIX_PROJECT}}.vsix | |
asset_content_type: application/zip | |
- name: Update release asset 2022 | |
if: github.event_name == 'push' | |
id: upload-release-asset-2022 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{steps.create_release.outputs.upload_url}} | |
asset_path: ${{env.VSIX2022}} | |
asset_name: ${{env.VSIX_PROJECT}}2022.vsix | |
asset_content_type: application/zip | |
- name: add to marketplace | |
if: github.event_name == 'push' | |
uses: mrluje/vs-marketplace-publisher@v2 | |
with: | |
pat: ${{ secrets.FCC_VS_MARKET_PLACE_PUBLISH_TOKEN }} | |
manifestPath: ${{github.workspace}}\vs-market-place-manifest.json | |
vsixPath: ${{env.VSIX}} | |
- name: add to marketplace 2022 | |
if: github.event_name == 'push' | |
uses: mrluje/vs-marketplace-publisher@v2 | |
with: | |
pat: ${{ secrets.FCC_VS_MARKET_PLACE_PUBLISH_TOKEN }} | |
manifestPath: ${{github.workspace}}\vs-market-place-manifest-2022.json | |
vsixPath: ${{env.VSIX2022}} | |
- name: comment - released and added to marketplace | |
if: github.event_name == 'push' | |
uses: tonyhallett/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
comment: released ${{steps.next-version.outputs.version_tag}} and available on marketplace | |
addTo: pullandissues |