Merge pull request #49 from gbrueckl/dev_gbrueckl #3
  
    
      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
    
  
  
    
  | on: | |
| workflow_dispatch: | |
| inputs: | |
| publish: | |
| description: 'Publish to Marketplace' | |
| required: true | |
| type: choice | |
| options: | |
| - 'true' | |
| - 'false' | |
| default: 'true' | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: write | |
| name: Create Release and Publish to Marketplace | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Install npm | |
| run: npm install | |
| - name: Install vsce | |
| run: npm i -g vsce | |
| # we first publish to VSCode gallery | |
| # in case that version is already there, it would fail and also not overwrite the Github Release | |
| - name: Publish extension to VSCode Marketplace | |
| if: ${{ (inputs.publish == 'true') || (github.event_name == 'push') }} | |
| env: | |
| VSCE_PUBLISH_TOKEN: ${{ secrets.VSCE_PUBLISH_TOKEN }} | |
| run: vsce publish -p $VSCE_PUBLISH_TOKEN | |
| - name: Publish extension to Open VSX Registry | |
| uses: HaaLeo/publish-vscode-extension@v2 | |
| id: publishToOpenVSX | |
| if: ${{ (inputs.publish == 'true') || (github.event_name == 'push') }} | |
| with: | |
| pat: ${{ secrets.OPENVSX_PUBLISH_TOKEN }} | |
| - name: Calculate version/tag-name from package.json | |
| id: calculatePackageVersion | |
| run: | | |
| PACKAGE_VERSION=`cat package.json | jq ".version" -M | sed 's/\"//g'` | |
| echo "PackageVersion=v$PACKAGE_VERSION" >> $GITHUB_OUTPUT | |
| echo "package version = v$PACKAGE_VERSION" | |
| - name: Package extension | |
| run: vsce package | |
| - name: Top 50 Changelog.md | |
| run: head -n 50 CHANGELOG.md >> CHANGELOG_Short.md | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| body_path: CHANGELOG_Short.md | |
| tag_name: ${{ steps.calculatePackageVersion.outputs.PackageVersion }} | |
| files: | | |
| *.vsix | |
| CHANGELOG.md | |