Skip to content

Nightly

Nightly #126

Workflow file for this run

# Copyright (C) 2019-2023 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: "0 3 * * *"
workflow_dispatch:
jobs:
check_latest_commit:
runs-on: "ubuntu-latest"
name: "Check latest commit"
outputs:
NEW_COMMIT: ${{ steps.check_latest_commit.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"
run: echo 'NEW_COMMIT='$(test -n "$(git log --format=%H --since='48 hours ago')" && echo 'true' || echo 'false') >> $GITHUB_OUTPUT
deploy:
name: "Nightly - Deploy Job"
needs: check_latest_commit
if: ${{ needs.check_latest_commit.outputs.NEW_COMMIT == 'true' || github.event_name == 'workflow_dispatch' }}
runs-on: "ubuntu-latest"
steps:
- name: "Checkout Repository"
uses: "actions/checkout@v4"
- name: "Set up Java"
uses: "actions/setup-java@v4"
with:
java-version: "21"
distribution: "temurin"
- name: "Set up Python"
uses: "actions/setup-python@v5"
with:
python-version: "3.10"
- name: "Install Python Dependencies"
run: "python -u -m pip install --upgrade pip && pip install semver==2.13.0"
- name: "Set LTEX_LS_VERSION"
run: "echo \"LTEX_LS_VERSION=$(python -u -c \"import datetime; import re; print('{}.nightly.{}'.format(re.search(r'<version>(.*?)(?:\\\\.develop)?</version>', open('pom.xml', 'r').read()).group(1), datetime.datetime.today().strftime('%Y-%m-%d')), end='')\")\" >> $GITHUB_ENV"
- name: "Check LTEX_LS_VERSION"
run: "if [[ -z \"$LTEX_LS_VERSION\" ]]; then echo 'Error: LTEX_LS_VERSION not set!'; (exit 1); fi; echo \"LTEX_LS_VERSION set to '$LTEX_LS_VERSION'\""
- name: "Bump Version"
run: "python -u -c \"import re\nfile = open('pom.xml', 'r+'); pom = file.read(); file.seek(0); file.truncate(); file.write(re.sub(r'<version>(.*?)</version>', '<version>${{ env.LTEX_LS_VERSION }}</version>', pom, 1))\""
- name: "Create Completion Lists"
run: "python -u tools/createCompletionLists.py"
- name: "Build LTeX LS"
run: "mvn -B -e package"
- name: "Create Binary Archives"
run: "python -u tools/createBinaryArchives.py"
- name: "Delete Old Nightly Releases"
uses: "dev-drprasad/[email protected]"
with:
keep_latest: 0
delete_tag_pattern: "nightly"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: "Update Nightly Tag"
run: "git tag -f nightly && git push -f origin nightly"
- name: "Create GitHub Release"
uses: "softprops/[email protected]"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
tag_name: "nightly"
name: "${{ env.LTEX_LS_VERSION }}"
prerelease: true
body: "This is a nightly build. Use at your own risk."
files: "target/ltex-ls-plus-${{ env.LTEX_LS_VERSION }}*.@(tar.gz|zip)"