-
-
Notifications
You must be signed in to change notification settings - Fork 3
87 lines (70 loc) · 3.18 KB
/
nightly.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Copyright (C) 2019-2025
# Julian Valentin, Daniel Spitzer, 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.13"
- name: "Install Python Dependencies"
run: "python -u -m pip install --upgrade pip && pip install semver"
- 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"
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.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)"