From ea099b276ac6038d5d92b01472e84ab87c345ae3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cenk=20K=C3=BCc=C3=BCk?= Date: Fri, 20 Nov 2026 12:28:53 +0000 Subject: [PATCH 1/2] Harden GitHub Actions workflows --- .github/dependabot.yml | 4 ++ .github/workflows/codespell.yml | 16 ++++++- .github/workflows/docusaurus.yml | 72 +++++++++++++++++++++++--------- 3 files changed, 71 insertions(+), 21 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index e91cae9de..12e19fdb8 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,7 +5,11 @@ updates: schedule: interval: monthly versioning-strategy: increase + cooldown: + default-days: 7 - package-ecosystem: github-actions directory: "/" schedule: interval: monthly + cooldown: + default-days: 7 diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml index a8dd42fda..490b13592 100644 --- a/.github/workflows/codespell.yml +++ b/.github/workflows/codespell.yml @@ -5,12 +5,24 @@ on: push: branches: [ master ] +permissions: {} + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: codespell: + name: Codespell runs-on: ubuntu-latest + timeout-minutes: 5 + permissions: + contents: read steps: - - uses: actions/checkout@v2 - - uses: codespell-project/actions-codespell@v2 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: codespell-project/actions-codespell@e3258cca84ce02b0bb36a3d41f2c18f719a0cc1a # v2.4.3 with: check_filenames: true ignore_words_file: .codespellignore diff --git a/.github/workflows/docusaurus.yml b/.github/workflows/docusaurus.yml index 42fc2f25b..1542e17f1 100644 --- a/.github/workflows/docusaurus.yml +++ b/.github/workflows/docusaurus.yml @@ -2,44 +2,78 @@ name: Docusaurus site CI on: push: - branches: [ master, upgrade ] + branches: [ master ] workflow_dispatch: +permissions: {} + +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: false + jobs: build: + name: Build runs-on: ubuntu-latest + timeout-minutes: 20 + permissions: + contents: read steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 0 + persist-credentials: false - - uses: actions/setup-node@v3 + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: - node-version: '21' + node-version-file: .tool-versions cache: 'npm' - - run: npm install + - run: npm ci - run: npm run build + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: site + path: build/ + retention-days: 1 + if-no-files-found: error + + deploy: + name: Deploy + needs: build + runs-on: ubuntu-latest + timeout-minutes: 15 + environment: production + permissions: {} + steps: + - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 + with: + name: site + path: build/ + - name: Tailscale - uses: tailscale/github-action@v2 + uses: tailscale/github-action@064b10558093f38325e838ddea35486bdc6b1d5c # v4.4.0 with: oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }} oauth-secret: ${{ secrets.TS_OAUTH_SECRET }} - version: '1.50.1' tags: tag:static-sites - name: Deploy to Static Sites Host - uses: burnett01/rsync-deployments@6.0.0 - with: - switches: -avzr --delete - path: build/ - remote_path: /var/www/docs/ - remote_host: ${{ secrets.DEPLOY_STATIC_SITE_HOST }} - remote_user: ${{ secrets.DEPLOY_STATIC_SITE_USER }} - remote_key: ${{ secrets.DEPLOY_STATIC_SITE_KEY }} + env: + DEPLOY_HOST: ${{ secrets.DEPLOY_STATIC_SITE_HOST }} + DEPLOY_USER: ${{ secrets.DEPLOY_STATIC_SITE_USER }} + DEPLOY_KNOWN_HOSTS: ${{ vars.DEPLOY_STATIC_SITE_KNOWN_HOSTS }} + run: | + test -n "$DEPLOY_KNOWN_HOSTS" || { echo "::error::DEPLOY_STATIC_SITE_KNOWN_HOSTS is not set"; exit 1; } + install -m 700 -d ~/.ssh + printf '%s\n' "$DEPLOY_KNOWN_HOSTS" > ~/.ssh/known_hosts + rsync -avzr --delete \ + -e "ssh -o BatchMode=yes -o HostKeyAlias=static-sites -o StrictHostKeyChecking=yes" \ + build/ "$DEPLOY_USER@$DEPLOY_HOST:/var/www/docs/" - name: Purge BunnyCDN cache - uses: eayllon/bunnycdn-purge-cache@253ab627f8e743b4d7f96e7020e8bc04377ac49d - with: - accessKey: ${{ secrets.BUNNY_API_KEY }} - zoneID: ${{ secrets.BUNNY_ZONE_ID }} + env: + BUNNY_API_KEY: ${{ secrets.BUNNY_API_KEY }} + BUNNY_ZONE_ID: ${{ secrets.BUNNY_ZONE_ID }} + run: | + curl -sS --fail-with-body -X POST -H "AccessKey: $BUNNY_API_KEY" "https://api.bunny.net/pullzone/$BUNNY_ZONE_ID/purgeCache" From 2bf3d5f561976f9e069269f58355c48bce6809c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cenk=20K=C3=BCc=C3=BCk?= Date: Fri, 20 Nov 2026 12:38:17 +0000 Subject: [PATCH 2/2] Pass Bunny AccessKey via stdin --- .github/workflows/docusaurus.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docusaurus.yml b/.github/workflows/docusaurus.yml index 1542e17f1..7527be606 100644 --- a/.github/workflows/docusaurus.yml +++ b/.github/workflows/docusaurus.yml @@ -76,4 +76,6 @@ jobs: BUNNY_API_KEY: ${{ secrets.BUNNY_API_KEY }} BUNNY_ZONE_ID: ${{ secrets.BUNNY_ZONE_ID }} run: | - curl -sS --fail-with-body -X POST -H "AccessKey: $BUNNY_API_KEY" "https://api.bunny.net/pullzone/$BUNNY_ZONE_ID/purgeCache" + printf 'AccessKey: %s\n' "$BUNNY_API_KEY" | + curl -sS --fail-with-body --proto '=https' --max-time 60 -X POST -H @- \ + "https://api.bunny.net/pullzone/$BUNNY_ZONE_ID/purgeCache"