Skip to content

Commit

Permalink
feat: integrate polykey into workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
brynblack committed Oct 11, 2024
1 parent 929ffcc commit 77b625b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/clean.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ jobs:
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
ZONE_ID: ${{ secrets.ZONE_ID }}
AUTH_KEY: ${{ secrets.AUTH_KEY }}
AUTH_EMAIL: ${{ secrets.AUTH_EMAIL }}
POLYKEY_DOCS_CLOUDFLARE_CLEANUP_TOKEN: ${{ secrets.POLYKEY_DOCS_CLOUDFLARE_CLEANUP_TOKEN }}
run: |
echo 'Perform service deployment for feature'
nix develop .#ci --command bash -c $'
Expand Down
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
shellHook = ''
echo "Entering $(npm pkg get name)"
set -o allexport
. ./.env
. <(pk secrets env Polykey-Docs:.)
set +o allexport
set -v
${lib.optionalString ci ''
Expand Down
6 changes: 2 additions & 4 deletions scripts/certs_cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

response=$(curl -X GET "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/ssl/certificate_packs" \
-H "Content-Type: application/json" \
-H "X-Auth-Key: $AUTH_KEY" \
-H "X-Auth-Email: $AUTH_EMAIL")
-H "Authorization: Bearer $POLYKEY_DOCS_CLOUDFLARE_CLEANUP_TOKEN")

cert_ids=$(echo "$response" | jq -r --arg domain "$DOMAIN" '.result[] | select(.hosts[] | contains($domain)) | .id')

echo "$cert_ids" | while read -r cert_id; do
curl -X DELETE --url "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/ssl/certificate_packs/$cert_id" \
-H "Content-Type: application/json" \
-H "X-Auth-Key: $AUTH_KEY" \
-H "X-Auth-Email: $AUTH_EMAIL"
-H "Authorization: Bearer $POLYKEY_DOCS_CLOUDFLARE_CLEANUP_TOKEN"
done

0 comments on commit 77b625b

Please sign in to comment.