Rename extension filename before upload #346
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 | |
| on: | |
| push: | |
| branches: | |
| - 'master' | |
| repository_dispatch: | |
| workflow_dispatch: | |
| jobs: | |
| checksecret: | |
| name: check if VSCODE_MARKETPLACE_TLAPLUS_TOKEN is set in github secrets | |
| runs-on: ubuntu-latest | |
| outputs: | |
| is_MY_SECRET_set: ${{ steps.checksecret_job.outputs.is_MY_SECRET_set }} | |
| steps: | |
| - name: Check secret present | |
| id: checksecret_job | |
| env: | |
| MY_SECRET: ${{ secrets.VSCODE_MARKETPLACE_TLAPLUS_TOKEN }} | |
| run: | | |
| echo "is_MY_SECRET_set: ${{ env.MY_SECRET != '' }}" | |
| echo "::set-output name=is_MY_SECRET_set::${{ env.MY_SECRET != '' }}" | |
| build: | |
| ## Do not run this action without the marketplace token present, | |
| ## e.g., in a fork of this repo. | |
| needs: [checksecret] | |
| if: needs.checksecret.outputs.is_MY_SECRET_set == 'true' | |
| runs-on: macOS-latest | |
| steps: | |
| - uses: actions/checkout@v1 | |
| - uses: actions/setup-node@v1 | |
| with: | |
| node-version: '22.14.0' | |
| - name: Get (latest) TLC | |
| run: wget https://github.com/tlaplus/tlaplus/releases/download/v1.8.0/tla2tools.jar -O tools/tla2tools.jar | |
| - name: Get (latest) CommunityModules | |
| run: wget https://github.com/tlaplus/CommunityModules/releases/latest/download/CommunityModules-deps.jar -O tools/CommunityModules-deps.jar | |
| - name: Prepare Release | |
| run: | | |
| ## Create a git commit to use its date as the extension's version number below. | |
| git add tools/*.jar -f | |
| git commit -m "Latest CommunityModules and TLA+ tools" | |
| - name: Get current version | |
| id: version | |
| run: echo "::set-output name=version::$(git log -1 --format=%cd --date="format:%Y.%-m.%-d%H%M")" | |
| - name: Install dependencies | |
| run: | | |
| npm ci | |
| npm install -g vsce | |
| - name: Build | |
| run: | | |
| npm run vscode:prepublish | |
| vsce package | |
| - name: Check | |
| run: | | |
| npm run lint | |
| npm test --silent | |
| npm run test:tlaplus-grammar | |
| - name: Publish to Marketplace | |
| continue-on-error: true | |
| run: | | |
| vsce publish $(git log -1 --format=%cd --date="format:%Y.%-m.%-d%H%M") --pat "${{ secrets.VSCODE_MARKETPLACE_TLAPLUS_TOKEN }}" | |
| mv vscode-ide-1.7.0.vsix vscode-tlaplus-$(git log -1 --format=%cd --date="format:%Y.%-m.%-d%H%M").vsix | |
| ls -lah | |
| - name: Upload the file as an artifact | |
| continue-on-error: true | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: vscode-tlaplus-release-1.7.0.vsix | |
| path: | | |
| *.vsix | |
| - name: Publish to Open VSX | |
| continue-on-error: true | |
| run: | | |
| npm install --global ovsx | |
| git log -1 --format=%cd --date="format:%Y.%-m.%-d%H%M" | xargs -I {} jq '.version = "{}"' package.json > tmp.json && mv tmp.json package.json | |
| npx ovsx publish -p "${{ secrets.OPEN_VSX_TOKEN_TLAPLUS }}" |