Skip to content

Nightly

Nightly #151

Workflow file for this run

# Copyright (C) 2019-2021 Julian Valentin, LTeX Development Community
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
name: "Nightly"
on:
schedule:
- cron: "30 3 * * *"
workflow_dispatch:
jobs:
check_latest_commits:
runs-on: "ubuntu-latest"
name: "Check latest commit"
outputs:
NEW_COMMIT: ${{ steps.check_latest_commit.outputs.NEW_COMMIT }}
LTEX_LS_PLUS_NEW_COMMIT: ${{ steps.check_latest_commit_ltex-ls-plus.outputs.NEW_COMMIT }}
steps:
- name: "Checkout Repository"
uses: "actions/checkout@v4"
- id: "check_latest_commit"
name: "Check if there were any commits in the last 48 hours for vscode-ltex-plus"
run: echo 'NEW_COMMIT='$(test -n "$(git log --format=%H --since='48 hours ago')" && echo 'true' || echo 'false') >> $GITHUB_OUTPUT
- name: "Checkout Repository"
uses: "actions/checkout@v4"
with:
repository: ltex-plus/ltex-ls-plus
path: ltex-ls-plus
- id: "check_latest_commit_ltex-ls-plus"
name: "Check if there were any commits in the last 48 hours for ltex-ls-plus"
run: cd ltex-ls-plus && echo 'NEW_COMMIT='$(test -n "$(git log --format=%H --since='48 hours ago')" && echo 'true' || echo 'false') >> $GITHUB_OUTPUT
deploy:
needs: check_latest_commits
if: ${{ needs.check_latest_commits.outputs.NEW_COMMIT == 'true' || needs.check_latest_commits.outputs.LTEX_LS_PLUS_NEW_COMMIT == 'true' || github.event_name == 'workflow_dispatch' }}
name: "Nightly - Deploy Job"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout Repository"
uses: "actions/checkout@v4"
- name: "Set up Node.js"
uses: "actions/setup-node@v4"
with:
node-version: 22
- name: "Install Node.js Dependencies"
run: "npm install && npm install -g @vscode/vsce ovsx"
- name: "Set up Python"
uses: "actions/setup-python@v5"
with:
python-version: "3.13"
- name: "Install Python Dependencies"
run: "python -u -m pip install --upgrade pip && pip install semver"
- name: "Set VSCODE_LTEX_VERSION"
run: "echo \"VSCODE_LTEX_VERSION=$(python -u -c \"import datetime; import json; version = json.load(open('package.json', 'r'))['version']; print('{}.nightly.{}'.format((version[:-8] if version.endswith('.develop') else version), datetime.datetime.today().strftime('%Y-%m-%d')), end='')\")\" >> $GITHUB_ENV"
- name: "Check VSCODE_LTEX_VERSION"
run: "if [[ -z \"$VSCODE_LTEX_VERSION\" ]]; then echo 'Error: VSCODE_LTEX_VERSION not set!'; (exit 1); fi; echo \"VSCODE_LTEX_VERSION set to '$VSCODE_LTEX_VERSION'\""
- name: "Bump Version"
run: "python -u -c \"import json; file = open('package.json', 'r+'); json_ = json.loads(file.read()); json_['version'] = '${{ env.VSCODE_LTEX_VERSION }}'; file.seek(0); file.truncate(); file.write(json.dumps(json_, indent=2) + '\\n')\""
- name: "Update Version of LTeX LS"
env:
LTEX_GITHUB_OAUTH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: "python -u tools/updateLtexLsVersionAndHashDigests.py --tag nightly"
- name: "Build Package with vsce"
run: "vsce package"
- name: "Build Offline Packages"
env:
LTEX_GITHUB_OAUTH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: "python -u tools/createOfflinePackages.py"
- name: "Delete Old Nightly Releases"
run: "gh release delete nightly -y"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Update Nightly Tag"
run: "git tag -f nightly && git push -f origin nightly"
- name: "Create GitHub Release"
uses: "softprops/action-gh-release@v2"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
tag_name: "nightly"
name: "${{ env.VSCODE_LTEX_VERSION }}"
prerelease: true
body: "This is a nightly build. Use at your own risk."
files: "vscode-ltex-plus-${{ env.VSCODE_LTEX_VERSION }}-offline-*.vsix"