From c8df6863cc23c6c290a3cc35dbcaf6b40cfd3f44 Mon Sep 17 00:00:00 2001 From: rina Date: Sun, 8 Dec 2024 09:19:15 +1000 Subject: [PATCH 1/2] ci: refactor monthly.yml to use same build steps --- .github/workflows/monthly.yml | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/.github/workflows/monthly.yml b/.github/workflows/monthly.yml index 3485fe7..bf517af 100644 --- a/.github/workflows/monthly.yml +++ b/.github/workflows/monthly.yml @@ -3,10 +3,19 @@ on: schedule: - cron: "53 15 18 * *" # AEST 1:53 am on 18th day each month workflow_dispatch: + inputs: + push: { type: boolean, default: false, required: false } + +env: + COMMIT: ${{ github.sha }} jobs: flake-update: runs-on: ubuntu-latest + + outputs: + patches: ${{ steps.data.outputs.b64 }} + steps: - uses: actions/checkout@v4 - uses: cachix/install-nix-action@v25 @@ -21,6 +30,23 @@ jobs: nix flake update --commit-lock-file - run: | nix run github:katrinafyi/nix-patcher -- --commit --update + - run: | - nix build .#all -Lv - - run: git push + git format-patch $COMMIT -o new-patches + + - name: Encode patches + id: data + run: | + touch patches.tar.zst + [[ -d new-patches ]] && (cd new-patches && tar caf ../patches.tar.zst .) + (printf 'b64=' && base64 -w0 patches.tar.zst && echo) >> "$GITHUB_OUTPUT" + ls -lh *.tar* + + build: + if: always() + needs: [ flake-update ] + uses: ./.github/workflows/main.yml + with: + patches-b64: ${{ needs.flake-update.outputs.patches }} + push: ${{ inputs.push || github.event_name == 'schedule' }} + secrets: inherit From bda789a8cb4068dee77d3cee8c3b43cb176b8abf Mon Sep 17 00:00:00 2001 From: rina Date: Sun, 8 Dec 2024 09:34:02 +1000 Subject: [PATCH 2/2] ci: different prefixes for workflow calls --- .github/workflows/monthly.yml | 2 +- .github/workflows/update.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/monthly.yml b/.github/workflows/monthly.yml index bf517af..c7ffd41 100644 --- a/.github/workflows/monthly.yml +++ b/.github/workflows/monthly.yml @@ -42,7 +42,7 @@ jobs: (printf 'b64=' && base64 -w0 patches.tar.zst && echo) >> "$GITHUB_OUTPUT" ls -lh *.tar* - build: + monthly-build: if: always() needs: [ flake-update ] uses: ./.github/workflows/main.yml diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml index 2c552de..f4ef09f 100644 --- a/.github/workflows/update.yml +++ b/.github/workflows/update.yml @@ -83,7 +83,7 @@ jobs: (printf 'b64=' && base64 -w0 patches.tar.zst && echo) >> "$GITHUB_OUTPUT" ls -lh *.tar* - build: + update-build: if: always() needs: [ collate ] uses: ./.github/workflows/main.yml