Skip to content

Instantly share code, notes, and snippets.

- name: update policy
run: |
curl ${{ env.PUT_POL }} ${{ env.CURL_AUTH }} ${{ env.CURL_CONTENT }} ${{ env.CURL_DATA_UPOL }}
env:
PUT_POL: '-X PUT "https://api.cloudflare.com/client/v4/zones/${{ env.ZONE_TAG }}/access/apps/${{ env.APP_UID }}/policies/${{ env.POL_UID }}"'
CURL_DATA_UPOL: --data '{"precedence":1,"decision":"allow","name":"Allow team","include":[{"email":{"email":"update@example.com"}},{"email":{"email":"srhea@cloudflare.com"}}]}'
if: env.APP_STATE == '11010'
- name: create app
run: |
echo ::set-env name=APP_STATE::$(curl ${{ env.POST_APP }} ${{ env.CURL_AUTH }} ${{ env.CURL_CONTENT }} ${{ env.CURL_DATA_APP }} | jq -r '.errors[].code')
env:
POST_APP: '-X POST "https://api.cloudflare.com/client/v4/zones/${{ env.ZONE_TAG }}/access/apps"'
CURL_DATA_APP: --data '{"name":"Test Deploy","domain":"${{ env.ZONE_NAME }}","session_duration":"24h"}'
- name: create dns
run: |
curl ${{ env.POST }} ${{ env.CURL_AUTH }} ${{ env.CURL_CONTENT }} ${{ env.CURL_DATA }}
env:
POST: '-X POST "https://api.cloudflare.com/client/v4/zones/${{ env.ZONE_TAG }}/dns_records"'
CURL_DATA: --data '{"type":"A","name":"${{ env.ZONE_NAME }}","content":"1.1.1.1","ttl":120,"priority":10,"proxied":true}'
name: Deploy Cloudflare
on:
push:
branches:
- main
env:
HUGO_VERSION: 0.71.0
ZONE_NAME: dev-test.rhea.group
@TownLake
TownLake / blog-dev.sh
Created December 27, 2019 17:19
Shell script that will switch to your blog directory, start a testing Hugo server, wait for it to begin, and then connect it to the Internet via a free Cloudflare Argo Tunnel.
#!/bin/bash
trap "exit" INT TERM ERR
trap "kill 0" EXIT
# These lines make sure that the Hugo server and the Argo Tunnel processes are killed when you ctrl+c the terminal window.
cd /Users/samrhea/blog-samrhea
# This changes the directory to where my blog lives. Replace this with your own by running `pwd` in your blog directory and adding the output here.

Keybase proof

I hereby claim:

  • I am AustinCorridor on github.
  • I am samuelrhea (https://keybase.io/samuelrhea) on keybase.
  • I have a public key whose fingerprint is 333C 0EBD 2B26 47A1 191F F91C C4E1 5B23 1FD7 169D

To claim this, I am signing this object:

baseURL = "https://blog.samrhea.com/"
languageCode = "en-us"
title = "Sam Rhea's blog"
theme = "hugo-cactus-theme"
[params]
name = "Sam Rhea"
description = "Sam Rhea's blog"
bio = "A Texan in Portugal. "
# Enter optionally your twitter account
---
apiVersion: v1
kind: Service
metadata:
labels:
app: guestbook
name: guestbook
spec:
ports:
- name: http
@TownLake
TownLake / cloudflared-sidecar-example.yaml
Last active April 14, 2019 01:20
Sample of a k8s yaml file for an Argo Tunnel sidecar deployment
---
apiVersion: v1
kind: Service
metadata:
labels:
app: hello
name: hello
spec:
ports:
- name: http