|
| 1 | +name: Publish |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 |
| 7 | + |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + name: Publish |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - name: Checkout code |
| 14 | + uses: actions/checkout@v2 |
| 15 | + - name: Setup node |
| 16 | + uses: actions/setup-node@v1 |
| 17 | + with: |
| 18 | + node-version: '12.x' |
| 19 | + - name: Setup Environment |
| 20 | + run: node -e "console.log('PACKAGE_VERSION=' + require('./package.json').version + '\nPACKAGE_NAME=' + require('./package.json').name + '-' + require('./package.json').version)" >> $GITHUB_ENV |
| 21 | + - name: Verify versions |
| 22 | + run: node -e "if ('refs/tags/v' + '${{ env.PACKAGE_VERSION }}' !== '${{ github.ref }}') { console.log('::error' + 'Version Mismatch. refs/tags/v' + '${{ env.PACKAGE_VERSION }}', '${{ github.ref }}'); throw Error('Version Mismatch')} " |
| 23 | + - name: Install |
| 24 | + run: yarn |
| 25 | + - name: Package extension |
| 26 | + run: yarn run pack |
| 27 | + - name: Publish Extension |
| 28 | + run: yarn vsce publish --yarn --packagePath ./${{ env.PACKAGE_NAME }}.vsix -p ${{ secrets.MARKETPLACE_PAT }} |
| 29 | + - name: Generate Changelog |
| 30 | + id: changelog |
| 31 | + uses: mindsers/changelog-reader-action@v2 |
| 32 | + with: |
| 33 | + version: ${{ env.PACKAGE_VERSION }} |
| 34 | + path: ./CHANGELOG.md |
| 35 | + - name: Create GitHub release |
| 36 | + id: create_release |
| 37 | + uses: actions/create-release@v1 |
| 38 | + env: |
| 39 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 40 | + with: |
| 41 | + tag_name: ${{ github.ref }} |
| 42 | + release_name: v${{ env.PACKAGE_VERSION }} |
| 43 | + body: ${{ steps.changelog.outputs.changes }} |
| 44 | + draft: false |
| 45 | + prerelease: false |
| 46 | + - name: Upload GitHub release |
| 47 | + id: upload-release-asset |
| 48 | + uses: actions/upload-release-asset@v1 |
| 49 | + env: |
| 50 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 51 | + with: |
| 52 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 53 | + asset_path: ./${{ env.PACKAGE_NAME }}.vsix |
| 54 | + asset_name: ${{ env.PACKAGE_NAME }}.vsix |
| 55 | + asset_content_type: application/zip |
0 commit comments