Skip to content

Instantly share code, notes, and snippets.

@anglinb
Last active September 29, 2021 00:41
Show Gist options
  • Save anglinb/1189d6d48c3491aeae33f714b2bb5ab1 to your computer and use it in GitHub Desktop.
Save anglinb/1189d6d48c3491aeae33f714b2bb5ab1 to your computer and use it in GitHub Desktop.
Issue wildcard certificate for Heroku & Cloudflare
name: Issue Certificate
on:
schedule:
- cron: 32 4 * * 3
workflow_dispatch:
jobs:
request_certificate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Heroku
run: |
curl https://cli-assets.heroku.com/install.sh | sh
git clone https://github.com/Neilpang/acme.sh.git || true
cd ./acme.sh
./acme.sh --install --force
export CF_Token=$CLOUDFLARE_API_KEY
~/.acme.sh/acme.sh --server letsencrypt --issue -d $DOMAIN -d "*.$DOMAIN" --dns dns_cf
heroku certs:update "/home/runner/.acme.sh/$DOMAIN/fullchain.cer" "/home/runner/.acme.sh/$DOMAIN/$DOMAIN.key" --confirm $HEROKU_APP --app $HEROKU_APP
env:
DOMAIN: domain.com
HEROKU_APP: some-heroku-app
CLOUDFLARE_API_KEY: ${{ secrets.CLOUDFLARE_API_KEY }} # Make sure this can edit the DNS zone of domain.com
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment