Update #625
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: "Update" | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
schedule: | |
- cron: '0 0 * * MON' | |
permissions: | |
contents: write | |
jobs: | |
update-deps: | |
name: Update dependencies | |
runs-on: ubuntu-latest | |
outputs: | |
continue: ${{steps.status.outputs.continue}} | |
context: ${{steps.versions.outputs.context}} | |
luametatex: ${{steps.versions.outputs.luametatex}} | |
luatex: ${{steps.versions.outputs.luatex}} | |
steps: | |
- uses: actions/checkout@main | |
- uses: DeterminateSystems/nix-installer-action@main | |
- name: Set up github-actions name and email | |
run: | | |
git config user.name "github-actions" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
- name: Update flake lock file | |
id: status | |
run: | | |
nix flake update context context-fonts context-modules luatex | |
if (git status --porcelain | grep -q flake.lock) || ${{github.event_name != 'schedule'}}; then | |
# Always rebuild when job is not scheduled | |
# Update nixpkgs if other inputs are updated | |
nix flake update | |
echo "continue=1" | tee -a "$GITHUB_OUTPUT" | |
fi | |
- name: Refresh derivation versions | |
id: versions | |
if: steps.status.outputs.continue | |
run: | | |
nix eval --raw --apply 'pkgs: " | |
context=${pkgs.context-minimals.src.computedVersion} | |
luametatex=${pkgs.luametatex.computedVersion} | |
luatex=${pkgs.luatex.computedVersion} | |
"' .#packages.x86_64-linux | sed 's/^ *//g' | tee -a "$GITHUB_OUTPUT" | |
- name: Upload lock file artifact | |
if: steps.status.outputs.continue | |
uses: actions/upload-artifact@main | |
with: | |
name: flake.lock | |
path: flake.lock | |
build: | |
name: Build | |
needs: update-deps | |
if: needs.update-deps.outputs.continue | |
strategy: | |
matrix: | |
include: | |
- system: aarch64-darwin | |
runs-on: macos-14 | |
- system: aarch64-linux | |
runs-on: ubuntu-latest | |
- system: x86_64-darwin | |
runs-on: macos-13 | |
- system: x86_64-linux | |
runs-on: ubuntu-latest | |
runs-on: ${{matrix.runs-on}} | |
steps: | |
- uses: actions/checkout@main | |
- uses: DeterminateSystems/nix-installer-action@main | |
with: | |
extra-conf: | | |
extra-platforms = aarch64-darwin aarch64-linux x86_64-darwin x86_64-linux | |
- uses: cachix/cachix-action@master | |
with: | |
name: context-minimals | |
authToken: '${{secrets.CACHIX_AUTH_TOKEN}}' | |
- name: Install emulation support for ubuntu-latest | |
if: matrix.system == 'aarch64-linux' && matrix.runs-on == 'ubuntu-latest' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y binfmt-support qemu-user-static | |
- name: Download lock file artifact | |
uses: actions/download-artifact@main | |
with: | |
name: flake.lock | |
- name: Update default.nix versions | |
run: | | |
sed -i.orig 's/version = ".*"/version = "${{needs.update-deps.outputs.context}}"/' pkgs/context-minimals/default.nix | |
sed -i.orig 's/version = ".*"/version = "${{needs.update-deps.outputs.luametatex}}"/' pkgs/luametatex/default.nix | |
sed -i.orig 's/version = ".*"/version = "${{needs.update-deps.outputs.luatex}}"/' pkgs/luatex/default.nix | |
git clean -xfd | |
- name: Build derivations | |
run: | | |
nix build --print-out-paths --print-build-logs \ | |
.#packages.${{matrix.system}}.{luametatex,luatex,context-minimals.src,context-minimals} | |
- name: Enforce determinism | |
run: | | |
nix build --rebuild --print-out-paths --print-build-logs \ | |
.#packages.${{matrix.system}}.{luametatex,luatex,context-minimals.src,context-minimals} | |
release: | |
name: Release | |
needs: [ update-deps, build ] | |
if: needs.update-deps.outputs.continue | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@main | |
- name: Set up github-actions name and email | |
run: | | |
git config user.name "github-actions" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
- name: Download lock file artifact | |
uses: actions/download-artifact@main | |
with: | |
name: flake.lock | |
- name: Update default.nix versions | |
run: | | |
sed -i.orig 's/version = ".*"/version = "${{needs.update-deps.outputs.context}}"/' pkgs/context-minimals/default.nix | |
sed -i.orig 's/version = ".*"/version = "${{needs.update-deps.outputs.luametatex}}"/' pkgs/luametatex/default.nix | |
sed -i.orig 's/version = ".*"/version = "${{needs.update-deps.outputs.luatex}}"/' pkgs/luatex/default.nix | |
git clean -xfd | |
- name: Commit and push if upstream changes present | |
run: | | |
if [ -z "$(git status --porcelain)" ]; then | |
echo "No upstream changes present." | |
else | |
echo "Upstream changes present." | |
git add flake.lock pkgs/{context-minimals,luametatex,luatex}/default.nix | |
git commit -m "context-minimals: ${{needs.update-deps.outputs.context}}" | |
git push origin "${GITHUB_REF##*/}" | |
fi |