Build emacs-overlay #592
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: Build emacs-overlay | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| build-branch: | |
| description: "Branch for building emacs-overlay" | |
| required: true | |
| type: string | |
| schedule: | |
| - cron: "30 8 * * *" | |
| permissions: | |
| contents: write | |
| jobs: | |
| update: | |
| runs-on: ubuntu-latest | |
| if: github.repository_owner == 'djgoku' | |
| outputs: | |
| changes_exist: ${{ steps.update.outputs.changes_exist }} | |
| flake_lock: ${{ steps.update.outputs.flake_lock }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ inputs.build-branch || 'build-emacs-overlay' }} | |
| - uses: DeterminateSystems/nix-installer-action@main | |
| - uses: DeterminateSystems/magic-nix-cache-action@main | |
| - uses: jdx/mise-action@v2 | |
| with: | |
| working_directory: emacs-overlay | |
| install: false | |
| - name: Install mise nix plugin | |
| run: mise plugins install nix https://github.com/jbadeau/mise-nix.git | |
| - name: Update flake inputs | |
| id: update | |
| working-directory: emacs-overlay | |
| run: | | |
| mise run update | |
| if git diff --quiet flake.lock; then | |
| echo "No changes detected, build will be skipped" | |
| echo "changes_exist=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "Changes detected, build will be triggered" | |
| echo "changes_exist=true" >> $GITHUB_OUTPUT | |
| echo "flake_lock<<EOF" >> $GITHUB_OUTPUT | |
| cat flake.lock >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| fi | |
| build: | |
| if: needs.update.outputs.changes_exist == 'true' | |
| needs: update | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-15] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ inputs.build-branch || 'build-emacs-overlay' }} | |
| - uses: DeterminateSystems/nix-installer-action@main | |
| - uses: DeterminateSystems/magic-nix-cache-action@main | |
| - uses: jdx/mise-action@v2 | |
| with: | |
| working_directory: emacs-overlay | |
| install: false | |
| - name: Install mise nix plugin | |
| run: mise plugins install nix https://github.com/jbadeau/mise-nix.git | |
| - name: Write updated flake.lock | |
| working-directory: emacs-overlay | |
| run: echo '${{ needs.update.outputs.flake_lock }}' > flake.lock | |
| - name: Build Emacs | |
| working-directory: emacs-overlay | |
| run: mise run build | |
| push: | |
| if: needs.update.outputs.changes_exist == 'true' | |
| needs: [update, build] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ inputs.build-branch || 'build-emacs-overlay' }} | |
| - name: Write updated flake.lock | |
| working-directory: emacs-overlay | |
| run: echo '${{ needs.update.outputs.flake_lock }}' > flake.lock | |
| - name: Commit and push | |
| working-directory: emacs-overlay | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add flake.lock | |
| git commit -m "Updated flake inputs for latest emacs-overlay" | |
| git push |