Skip to content

Commit

Permalink
Merge pull request #27 from katrinafyi/refactor-monthly
Browse files Browse the repository at this point in the history
ci: refactor monthly.yml to use same build steps
  • Loading branch information
katrinafyi authored Dec 8, 2024
2 parents cd5eba4 + bda789a commit d5e8627
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
30 changes: 28 additions & 2 deletions .github/workflows/monthly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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*
monthly-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
2 changes: 1 addition & 1 deletion .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d5e8627

Please sign in to comment.