Update toolchain #307
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 toolchain | |
| on: | |
| schedule: | |
| - cron: "30 */2 * * *" | |
| workflow_dispatch: | |
| concurrency: | |
| group: update-toolchain | |
| cancel-in-progress: false | |
| jobs: | |
| main: | |
| runs-on: ubuntu-slim | |
| steps: | |
| - name: Create GitHub App token | |
| uses: actions/create-github-app-token@v3 | |
| id: app-token | |
| with: | |
| client-id: ${{ vars.DOWNSTREAM_LEAN4_APP_CLIENT_ID }} | |
| private-key: ${{ secrets.DOWNSTREAM_LEAN4_APP_PRIVATE_KEY }} | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| token: ${{ steps.app-token.outputs.token }} | |
| fetch-depth: 0 | |
| - name: Configure git | |
| uses: ./.downstream/actions/configure-git | |
| with: | |
| name: ${{ steps.app-token.outputs.app-slug }}[bot] | |
| - name: Find latest nightly release | |
| id: find-nightly | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| NIGHTLY_TAG="$(gh api repos/leanprover/lean4-nightly/releases?per_page=1 -q '.[0].tag_name')" | |
| echo "::notice::Found nightly tag $NIGHTLY_TAG" | |
| echo "nightly-tag=$NIGHTLY_TAG" >> "$GITHUB_OUTPUT" | |
| - name: Update toolchain | |
| env: | |
| NIGHTLY_TAG: ${{ steps.find-nightly.outputs.nightly-tag }} | |
| run: | | |
| echo "leanprover/lean4:$NIGHTLY_TAG" > lean-toolchain | |
| git add lean-toolchain | |
| git diff --cached --quiet || git commit -m "chore: bump toolchain to $NIGHTLY_TAG" | |
| - name: Push | |
| run: | | |
| git push origin HEAD:${{ github.ref_name }} |