|
1 | 1 | name: Release
|
2 | 2 |
|
3 |
| -on: workflow_dispatch |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: "0 6 * * *" |
| 6 | + repository_dispatch: |
| 7 | + workflow_dispatch: |
4 | 8 |
|
5 | 9 | jobs:
|
| 10 | + checksecret: |
| 11 | + name: check if VSCODE_MARKETPLACE_TLAPLUS_TOKEN is set in github secrets |
| 12 | + runs-on: ubuntu-latest |
| 13 | + outputs: |
| 14 | + is_MY_SECRET_set: ${{ steps.checksecret_job.outputs.is_MY_SECRET_set }} |
| 15 | + steps: |
| 16 | + - name: Check secret present |
| 17 | + id: checksecret_job |
| 18 | + env: |
| 19 | + MY_SECRET: ${{ secrets.VSCODE_MARKETPLACE_TLAPLUS_TOKEN }} |
| 20 | + run: | |
| 21 | + echo "is_MY_SECRET_set: ${{ env.MY_SECRET != '' }}" |
| 22 | + echo "::set-output name=is_MY_SECRET_set::${{ env.MY_SECRET != '' }}" |
| 23 | + |
6 | 24 | build:
|
| 25 | + ## Do not run this action without the marketplace token present, |
| 26 | + ## e.g., in a fork of this repo. |
| 27 | + needs: [checksecret] |
| 28 | + if: needs.checksecret.outputs.is_MY_SECRET_set == 'true' |
7 | 29 | runs-on: macOS-latest
|
8 | 30 | steps:
|
9 | 31 | - uses: actions/checkout@v1
|
10 | 32 | - uses: actions/setup-node@v1
|
11 | 33 | with:
|
12 | 34 | node-version: '18.19'
|
| 35 | + - name: Get (latest) TLC |
| 36 | + run: wget https://nightly.tlapl.us/dist/tla2tools.jar -O tools/tla2tools.jar |
| 37 | + - name: Get (latest) CommunityModules |
| 38 | + run: wget https://github.com/tlaplus/CommunityModules/releases/latest/download/CommunityModules-deps.jar -O tools/CommunityModules-deps.jar |
| 39 | + - name: Prepare Release |
| 40 | + run: | |
| 41 | + ## Create a git commit to use its date as the extension's version number below. |
| 42 | + git add tools/*.jar -f |
| 43 | + git commit -m "Latest CommunityModules and TLA+ tools" |
13 | 44 | - name: Get current version
|
14 | 45 | id: version
|
15 |
| - run: echo "::set-output name=version::$(jq -r .version package.json)" |
| 46 | + run: echo "::set-output name=version::$(git log -1 --format=%cd --date="format:%Y.%-m.%-d%H%M")" |
16 | 47 | - name: Install dependencies
|
17 | 48 | run: |
|
18 | 49 | npm install
|
|
26 | 57 | npm run lint
|
27 | 58 | npm test --silent
|
28 | 59 | - name: Publish to Marketplace
|
29 |
| - run: vsce publish --pat "${{ secrets.VSCODE_MARKETPLACE_TOKEN }}" |
30 |
| - - name: Publish to Open VSX |
31 |
| - run: npx ovsx publish "vscode-tlaplus-${{ steps.version.outputs.version }}.vsix" -p "${{ secrets.OPEN_VSX_TOKEN }}" |
| 60 | + run: | |
| 61 | + git diff |
| 62 | + git status |
| 63 | + vsce publish $(git log -1 --format=%cd --date="format:%Y.%-m.%-d%H%M") --pat "${{ secrets.VSCODE_MARKETPLACE_TLAPLUS_TOKEN }}" |
| 64 | + ## Continue publishing in the following steps even if publication to the VSCode marketplace fails. |
| 65 | + continue-on-error: true |
32 | 66 | - name: Create Release
|
33 | 67 | id: create_release
|
34 | 68 | uses: actions/create-release@v1
|
|
49 | 83 | asset_path: vscode-tlaplus-${{ steps.version.outputs.version }}.vsix
|
50 | 84 | asset_name: vscode-tlaplus-${{ steps.version.outputs.version }}.vsix
|
51 | 85 | asset_content_type: application/zip
|
| 86 | + |
0 commit comments