11name : release
22
33on :
4+ schedule :
5+ - cron : ' 0 8 * * *'
46 workflow_dispatch :
57 inputs :
68 publishPreRelease :
2931 default : ' true'
3032
3133jobs :
34+
35+ should-build-change :
36+ runs-on : ubuntu-latest
37+ outputs :
38+ repo-cache-hit : ${{ steps.cache-last-commit.outputs.cache-hit }}
39+ steps :
40+ - uses : actions/checkout@v4
41+ with :
42+ repository : " redhat-developer/vscode-yaml"
43+ fetch-depth : 2
44+ path : vscode-yaml
45+ - uses : actions/checkout@v4
46+ with :
47+ repository : " redhat-developer/yaml-language-server"
48+ fetch-depth : 2
49+ path : yaml-language-server
50+ - run : |
51+ pushd vscode-yaml
52+ git rev-parse HEAD >> ../lastCommit
53+ popd
54+ pushd yaml-language-server
55+ git rev-parse HEAD >> ../lastCommit
56+ - name : Check New Changes
57+ id : cache-last-commit
58+ uses : actions/cache@v4
59+ with :
60+ path : lastCommit
61+ key : lastCommit-${{ hashFiles('lastCommit') }}
62+
3263 packaging-job :
3364 runs-on : ubuntu-latest
65+ needs : should-build-change
66+ if : ${{ needs.should-build-change.outputs.repo-cache-hit != 'true' || github.event_name != 'schedule' }}
3467 steps :
3568 - name : Checkout vscode-yaml
3669 uses : actions/checkout@v4
@@ -39,10 +72,19 @@ jobs:
3972 with :
4073 path : release
4174 node-version : 20
75+ - name : Set version to prerelease version
76+ run : |
77+ node change-version-to-prerelease.mjs
78+ echo "publishPreReleaseFlag=--pre-release" >> $GITHUB_ENV
79+ if : ${{ github.event_name == 'schedule' || inputs.publishPreRelease == 'true'}}
4280 - name : Install dependencies
4381 run : |
4482 npm install -g typescript "@vscode/vsce" "ovsx"
4583 echo "EXT_VERSION=$(cat package.json | jq -r .version)" >> $GITHUB_ENV
84+ # Install latest yaml-language-server in the case of a prerelease
85+ - name : Update yaml-language-server
86+ if : ${{ github.event_name == 'schedule' || inputs.publishPreRelease == 'true'}}
87+ run : npm i yaml-language-server@next
4688 - name : Build vscode-yaml
4789 uses : coactions/setup-xvfb@b6b4fcfb9f5a895edadc3bc76318fae0ac17c8b3 # v1.0.1
4890 with :
5698 run : npm test --silent
5799 - name : Package
58100 run : |
59- vsce package -o vscode-yaml-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}.vsix
101+ vsce package ${{ env.publishPreReleaseFlag }} -o vscode-yaml-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}.vsix
60102 sha256sum *.vsix > vscode-yaml-${{ env.EXT_VERSION }}-${GITHUB_RUN_NUMBER}.vsix.sha256
61103 ls -lash *.vsix *.sha256
62104 - name : Upload VSIX Artifacts
0 commit comments