From 9d892d39233467799b0a9e02ca93c67d457004e0 Mon Sep 17 00:00:00 2001 From: Andrew Jackson Date: Wed, 20 Nov 2024 13:58:35 +0000 Subject: [PATCH] R2 library uploader --- .github/workflows/json_library_upload.yml | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/json_library_upload.yml diff --git a/.github/workflows/json_library_upload.yml b/.github/workflows/json_library_upload.yml new file mode 100644 index 000000000..8e8195b71 --- /dev/null +++ b/.github/workflows/json_library_upload.yml @@ -0,0 +1,30 @@ +name: JSON Library Upload + +on: + workflow_dispatch: + +jobs: + librarian: + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Upload library + uses: ryand56/r2-upload-action@latest + with: + r2-account-id: ${{ secrets.R2_ACCOUNT_ID }} + r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }} + r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }} + r2-bucket: ${{ secrets.R2_BUCKET }} + source-dir: ./custom_components/battery_notes/data/ + keep-file-fresh: true + + - name: Purge cache for latest schema + uses: jakejarvis/cloudflare-purge-action@master + env: + CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_ZONE }} + CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }} + PURGE_URLS: '["https://battery-notes-data.codechimp.org/library.json"]'