π Update Dependencies #165
This file contains hidden or 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: π Update Dependencies | |
| permissions: | |
| contents: write | |
| actions: write | |
| on: | |
| schedule: | |
| - cron: '0 4 * * *' | |
| workflow_dispatch: | |
| jobs: | |
| update-main: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout main | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| - name: Set up Bun | |
| uses: oven-sh/setup-bun@v1 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| run: | | |
| cd .github/scripts | |
| bun install | |
| cd ../.. | |
| - name: Update versions (main) | |
| run: | | |
| bun run .github/scripts/update_versions.ts | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Commit, push and tag if updated (main) | |
| id: commit_and_push_main | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| git add .github/data/dependencies.json README.md | |
| if git diff --cached --quiet; then | |
| echo "No changes to commit." | |
| echo "release_needed=false" >> $GITHUB_OUTPUT | |
| exit 0 | |
| fi | |
| git commit -m "chore: update dependencies and versions [auto]" | |
| git push | |
| VERSION=$(jq -r '.project.version' .github/data/dependencies.json) | |
| git tag "v$VERSION" | |
| git push origin "v$VERSION" | |
| echo "release_needed=true" >> $GITHUB_OUTPUT | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Trigger Release Workflow (main) | |
| uses: actions/github-script@v7 | |
| if: steps.commit_and_push_main.outputs.release_needed == 'true' | |
| with: | |
| script: | | |
| await github.rest.actions.createWorkflowDispatch({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| workflow_id: "release.yml", | |
| ref: "main" | |
| }) | |
| update-next: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout next | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: next | |
| - name: Set up Bun | |
| uses: oven-sh/setup-bun@v1 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| run: | | |
| cd .github/scripts | |
| bun install | |
| cd ../.. | |
| - name: Update versions (next) | |
| run: | | |
| bun run .github/scripts/update_versions.ts | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Commit and push updated dependencies.json and README.md (next) | |
| id: commit_and_push_next | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| git add .github/data/dependencies.json README.md | |
| if git diff --cached --quiet; then | |
| echo "No changes to commit." | |
| echo "release_needed=false" >> $GITHUB_OUTPUT | |
| exit 0 | |
| fi | |
| git commit -m "chore: update dependencies and versions [auto]" | |
| git push | |
| echo "release_needed=true" >> $GITHUB_OUTPUT | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Trigger Release Workflow (main) | |
| uses: actions/github-script@v7 | |
| if: steps.commit_and_push_next.outputs.release_needed == 'true' | |
| with: | |
| script: | | |
| await github.rest.actions.createWorkflowDispatch({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| workflow_id: "release-next.yml", | |
| ref: "next" | |
| }) |