Nightly #103
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (C) 2021-2025 | |
# Julian Valentin, Daniel Spitzer, lsp-cli 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: | |
name: "Check latest commit" | |
runs-on: "ubuntu-latest" | |
permissions: | |
contents: read | |
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: | |
needs: check_latest_commit | |
if: ${{ needs.check_latest_commit.outputs.NEW_COMMIT == 'true' || github.event_name == 'workflow_dispatch' }} | |
name: "Nightly - Deploy Job" | |
runs-on: "ubuntu-latest" | |
permissions: | |
contents: write | |
steps: | |
- name: "Checkout Repository" | |
uses: "actions/checkout@v4" | |
- name: "Set up Java" | |
uses: "actions/setup-java@v4" | |
with: | |
distribution: "temurin" | |
java-version: "21" | |
- name: "Set up Python" | |
uses: "actions/setup-python@v5" | |
with: | |
python-version: "3.13" | |
- name: "Install Python Dependencies" | |
run: "python -m pip install --upgrade pip && pip install semver" | |
- name: "Set LSP_CLI_PLUS_VERSION" | |
run: "echo \"LSP_CLI_PLUS_VERSION=$(python -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 LSP_CLI_PLUS_VERSION" | |
run: "if [[ -z \"$LSP_CLI_PLUS_VERSION\" ]]; then echo 'Error: LSP_CLI_PLUS_VERSION not set!'; (exit 1); fi; echo \"LSP_CLI_PLUS_VERSION set to '$LSP_CLI_PLUS_VERSION'\"" | |
- name: "Bump Version" | |
run: "python -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.LSP_CLI_PLUS_VERSION }}</version>', pom, 1))\"" | |
- name: "Build lsp-cli-plus" | |
run: "mvn -B -e package" | |
- name: "Create Binary Archives" | |
run: "python tools/createBinaryArchives.py" | |
- name: "Delete Old Nightly Releases" | |
run: "gh release delete nightly -y" | |
continue-on-error: true | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: "Update Nightly Tag" | |
run: "git tag -f nightly && git push -f origin nightly" | |
- name: "Create GitHub Release" | |
run: > | |
gh release create nightly | |
--prerelease=true | |
--title='${{ env.LSP_CLI_PLUS_VERSION }}' | |
--notes='This is a nightly build. Use at your own risk.' | |
'target/lsp-cli-plus-${{ env.LSP_CLI_PLUS_VERSION }}.tar.gz' | |
'target/lsp-cli-plus-${{ env.LSP_CLI_PLUS_VERSION }}-linux-x64.tar.gz' | |
'target/lsp-cli-plus-${{ env.LSP_CLI_PLUS_VERSION }}-mac-x64.tar.gz' | |
'target/lsp-cli-plus-${{ env.LSP_CLI_PLUS_VERSION }}-windows-x64.zip' | |
'target/lsp-cli-plus-${{ env.LSP_CLI_PLUS_VERSION }}-linux-aarch64.tar.gz' | |
'target/lsp-cli-plus-${{ env.LSP_CLI_PLUS_VERSION }}-mac-aarch64.tar.gz' | |
'target/lsp-cli-plus-${{ env.LSP_CLI_PLUS_VERSION }}-windows-aarch64.zip' | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |