Daily Update and Release #136
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 | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
# keep consistency with local devcontainer settings | |
- name: Install dependencies for just tasks | |
env: | |
PIPX_BIN_DIR: /usr/local/py-utils/bin | |
PIPX_HOME: /usr/local/py-utils | |
run: | | |
sudo mkdir -p $PIPX_BIN_DIR $PIPX_HOME | |
sudo chown $USER:$USER $PIPX_BIN_DIR $PIPX_HOME | |
echo $PIPX_BIN_DIR >> $GITHUB_PATH | |
bash .devcontainer/install-deps.sh | |
shell: bash | |
- name: Update lsp-bridge.nix and run tests | |
id: update_and_test | |
run: | | |
if ! just test invalidate_hash; 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 | |
just generate | |
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' | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
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 | |
- name: Trigger release workflow | |
if: steps.update_and_test.outputs.test_passed == 'true' | |
uses: peter-evans/repository-dispatch@v3 | |
with: | |
event-type: trigger-release |