tlaplus-dispatch #127
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: Release | |
on: | |
push: | |
branches: | |
- 'main' | |
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: '18.19' | |
- name: Get (latest) TLC | |
run: wget https://nightly.tlapl.us/dist/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 install | |
npm install -g vsce | |
- name: Build | |
run: | | |
npm run vscode:prepublish | |
vsce package | |
- name: Check | |
run: | | |
npm run lint | |
npm test --silent | |
- name: Publish to Marketplace | |
run: | | |
vsce publish $(git log -1 --format=%cd --date="format:%Y.%-m.%-d%H%M") --pat "${{ secrets.VSCODE_MARKETPLACE_TLAPLUS_TOKEN }}" |