Skip to content

Commit

Permalink
b64 input
Browse files Browse the repository at this point in the history
  • Loading branch information
katrinafyi committed Sep 4, 2024
1 parent dbfa344 commit 505854b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 19 deletions.
26 changes: 17 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ on:
workflow_dispatch:
inputs:
push: { type: boolean, default: false }
run-id:
patches-b64: { type: string, required: false }
workflow_call:
inputs:
push: { type: boolean, default: false, required: false }
patches-url: { type: string, required: false }
patches-b64: { type: string, required: false }

jobs:
update-check:
if: ${{ ! inputs.patches-url }}
if: ${{ ! inputs.patches-b64 }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -46,13 +46,17 @@ jobs:
with: { name: pac-nix, authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}', skipPush: "${{ github.ref != 'refs/heads/main' }}" }

- name: Apply staged patch commits
if: ${{ inputs.patches-url }}
if: ${{ inputs.patches-b64 }}
run: |
shopt -s nullglob
set -x
wget -O patches.zip '${{ inputs.patches-url }}'
unzip patches.zip -d prev-patches
cat <<EOF | base64 -d > patches.tar.zst
${{ inputs.patches-b64 }}
EOF
mkdir prev-patches
tar xaf patches.tar.zst -C prev-patches
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
Expand Down Expand Up @@ -99,13 +103,17 @@ jobs:
[[ $result == success || $result == skipped ]]
- name: Apply staged patch commits
if: ${{ inputs.patches-url }}
if: ${{ inputs.patches-b64 }}
run: |
shopt -s nullglob
set -x
wget -O patches.zip '${{ inputs.patches-url }}'
unzip patches.zip -d prev-patches
cat <<EOF | base64 -d > patches.tar.zst
${{ inputs.patches-b64 }}
EOF
mkdir prev-patches
tar xaf patches.tar.zst -C prev-patches
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
Expand Down
16 changes: 6 additions & 10 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
runs-on: ubuntu-latest
needs: [ update ]
outputs:
url: ${{ steps.public.outputs.url }}
patches: ${{ steps.data.outputs.b64 }}
steps:
- uses: actions/download-artifact@v4
with:
Expand All @@ -76,28 +76,24 @@ jobs:
name: 'partial-patches-*'

- uses: actions/upload-artifact@v4
id: upload
with:
name: all-patches
path: prev-patches
if-no-files-found: ignore

- name: Re-upload to public site
id: public
id: data
run: |
set -x
(cd prev-patches && zip -r ../patches.zip .)
# accessing github actions artifacts too hard...
url="$(curl -F'[email protected]' https://0x0.st)"
echo "$url"
[[ -n "$url" ]]
echo "url=$url" >> "$GITHUB_OUTPUT"
(cd prev-patches && tar caf ../patches.tar.zst .)
(printf 'b64=' && base64 -w0 patches.tar.zst && echo) >> "$GITHUB_OUTPUT"
ls -lh *.tar*
build:
needs: [ collate ]
uses: ./.github/workflows/main.yml
with:
patches-url: ${{ needs.collate.outputs.url }}
patches-b64: ${{ needs.collate.outputs.patches }}
push: ${{ inputs.push || github.event_name == 'schedule' }}
secrets: inherit

0 comments on commit 505854b

Please sign in to comment.