ci: Version control manifests in separate repo #3
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 Lean toolchain manifest | |
| on: | |
| push: | |
| branches: [ci-manifest] | |
| workflow_dispatch: | |
| #workflow_trigger: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| # Whenever tags are updated in lean4-nix-manifests, or manually triggered | |
| # Go through all tags & refs for lean4-nix-manifests and write them to manifests.nix | |
| # Update the template versions to latest manifest | |
| # Commit changes to new branch | |
| # Open PR to `dev` | |
| jobs: | |
| update: | |
| name: Update Lean manifest | |
| runs-on: ubuntu-latest | |
| env: | |
| MANIFEST_DIR: "${{ github.workspace }}/manifests" | |
| MANIFEST_FILE: "${{ github.workspace }}/manifests.nix" | |
| steps: | |
| - run: sudo apt-get install ripgrep | |
| - uses: actions/checkout@v4 | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-tags: true | |
| repository: argumentcomputer/lean4-nix-manifests | |
| path: ${{ env.MANIFEST_DIR }} | |
| - name: Get tags and refs | |
| run: | | |
| cat > ${{ env.MANIFEST_FILE }} << 'EOF' | |
| # This file is auto-generated by `.github/workflows/update-manifests.yml` | |
| # List of tags and Git revs at https://github.com/argumentcomputer/lean4-nix-manifests | |
| # Revs are needed to use `builtins.fetchGit` in pure evaluation mode | |
| EOF | |
| echo "{" | tee -a ${{ env.MANIFEST_FILE }} | |
| git for-each-ref --format=' "%(refname:short)" = "%(objectname)";' refs/tags | tee -a ${{ env.MANIFEST_FILE }} | |
| echo "}" | tee -a ${{ env.MANIFEST_FILE }} | |
| working-directory: ${{ env.MANIFEST_DIR }} | |
| - name: Update template versions to latest | |
| run: | | |
| # Get latest version from `manifests.nix` | |
| NEW_VERSION=$(tail -n 2 ${{ env.MANIFEST_FILE }} | head -n 1 | awk '{ print $1 }' | tr -d '"') | |
| # Update all toolchain files to new version | |
| rg --files templates/**/lean-toolchain | xargs sed -i "s|lean4:.*|lean4:$NEW_VERSION|g" | |
| - run: git diff | |
| #- name: Create pull request with changes | |
| # uses: peter-evans/create-pull-request@v7 |