Daily Update and Release #4
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
name: "Daily Update and Release" | |
on: | |
schedule: | |
- cron: '0 0 * * *' # Run daily at midnight UTC | |
workflow_dispatch: # Allow manual triggering | |
jobs: | |
update-and-test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Nix | |
uses: cachix/install-nix-action@v27 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
- name: Install just and jq | |
run: | | |
nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs | |
nix-channel --update | |
nix-env -iA nixpkgs.just nixpkgs.jq | |
shell: bash | |
- name: Update lsp-bridge.nix and run tests | |
id: update_and_test | |
run: | | |
if ! just test; then | |
echo "First test run failed, retrying..." | |
if just test; then | |
echo "Second test run succeeded" | |
echo "test_passed=true" >> $GITHUB_OUTPUT | |
# update the version for release tag | |
just update_version | |
else | |
echo "Second test after re-generation run failed" | |
exit 1 | |
fi | |
fi | |
- name: Commit and push changes if any | |
if: steps.update_and_test.outputs.test_passed == 'true' | |
run: | | |
git config --global user.name 'GitHub Actions Bot' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git add _generator/ src/ test/ | |
if git diff --staged --quiet; then | |
echo "No changes to commit" | |
else | |
git commit -m "Update lsp-bridge to latest version" | |
git push | |
fi |