|
| 1 | +name: Push vsix artifact pull release and comment |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - master |
| 6 | + pull_request: |
| 7 | + branches: |
| 8 | + - master |
| 9 | + types: [opened, synchronize, edited] |
| 10 | +env: |
| 11 | + CONFIGURATION: Release |
| 12 | + VSIX_PROJECT: FineCodeCoverage |
| 13 | +jobs: |
| 14 | + push-vsix-artifact-pull-release-and-comment: |
| 15 | + name: Push vsix artifact pull release and comment |
| 16 | + runs-on: windows-2019 |
| 17 | + steps: |
| 18 | + - name: create variables |
| 19 | + shell: bash |
| 20 | + run: | |
| 21 | + echo "SOLN=${{env.VSIX_PROJECT}}.sln" >> $GITHUB_ENV |
| 22 | + echo "VSIX=${{github.workspace}}\${{env.VSIX_PROJECT}}\bin\${{env.CONFIGURATION}}\${{env.VSIX_PROJECT}}.vsix" >> $GITHUB_ENV # full path required for vsix publish |
| 23 | + - name: checkout |
| 24 | + uses: actions/checkout@v2 |
| 25 | + with: |
| 26 | + fetch-depth: 0 |
| 27 | + - name: Determine next version |
| 28 | + id: next-version |
| 29 | + |
| 30 | + with: |
| 31 | + short_tags: false |
| 32 | + branch: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || 'HEAD' }} |
| 33 | + |
| 34 | + - name: set up msbuild |
| 35 | + |
| 36 | + |
| 37 | + - name: set up VSTest |
| 38 | + uses: darenm/Setup-VSTest@v1 |
| 39 | + |
| 40 | + - name: nuget restore |
| 41 | + run: nuget restore ${{env.SOLN}} |
| 42 | + |
| 43 | + - name: Set version for Visual Studio Extension |
| 44 | + uses: cezarypiatek/[email protected] |
| 45 | + with: |
| 46 | + version: ${{steps.next-version.outputs.major}}.${{steps.next-version.outputs.minor}}.${{github.run_number}}.${{steps.next-version.outputs.patch}} |
| 47 | + vsix-manifest-file: ${{env.VSIX_PROJECT}}\source.extension.vsixmanifest |
| 48 | + |
| 49 | + - name: build vsix |
| 50 | + run: | |
| 51 | + msbuild ${{env.SOLN}} /p:Configuration=${{env.CONFIGURATION}} /p:DeployExtension=False /verbosity:minimal |
| 52 | +
|
| 53 | + - name: vs test solution |
| 54 | + uses: tonyhallett/[email protected] |
| 55 | + |
| 56 | + # above are common steps for push and pull |
| 57 | + |
| 58 | + # pull only |
| 59 | + - name: upload vsix |
| 60 | + if: github.event_name == 'pull_request' && !github.event.pull_request.draft |
| 61 | + uses: actions/upload-artifact@v2 |
| 62 | + with: |
| 63 | + name: FineCodeCoverage ( zipped vsix) |
| 64 | + path: ${{env.VSIX}} |
| 65 | + |
| 66 | + # push only |
| 67 | + - name: create release |
| 68 | + if: github.event_name == 'push' |
| 69 | + id: create_release |
| 70 | + uses: actions/create-release@v1 |
| 71 | + env: |
| 72 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 73 | + with: |
| 74 | + tag_name: ${{steps.next-version.outputs.version_tag}} |
| 75 | + release_name: ${{steps.next-version.outputs.version_tag}} |
| 76 | + draft: false |
| 77 | + prerelease: falses |
| 78 | + - name: Update release asset |
| 79 | + if: github.event_name == 'push' |
| 80 | + id: upload-release-asset |
| 81 | + uses: actions/upload-release-asset@v1 |
| 82 | + env: |
| 83 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 84 | + with: |
| 85 | + upload_url: ${{steps.create_release.outputs.upload_url}} |
| 86 | + asset_path: ${{env.VSIX}} |
| 87 | + asset_name: ${{env.VSIX_PROJECT}}.vsix |
| 88 | + asset_content_type: application/zip |
| 89 | + - name: add to marketplace |
| 90 | + if: github.event_name == 'push' |
| 91 | + uses: mrluje/vs-marketplace-publisher@v2 |
| 92 | + with: |
| 93 | + pat: ${{ secrets.FCC_VS_MARKET_PLACE_PUBLISH_TOKEN }} |
| 94 | + manifestPath: ${{env.VSIX_PROJECT}}\vs-market-place-manifest.json |
| 95 | + vsixPath: ${{env.VSIX}} |
| 96 | + - name: comment - released and added to marketplace |
| 97 | + if: github.event_name == 'push' |
| 98 | + uses: tonyhallett/[email protected] |
| 99 | + env: |
| 100 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 101 | + with: |
| 102 | + comment: released ${{steps.next-version.outputs.version_tag}} and available on marketplace |
| 103 | + addTo: pullandissues |
0 commit comments