Skip to content

Commit

Permalink
Set up CI workflows (validate, test, deploy)
Browse files Browse the repository at this point in the history
These are heavily inspired by Hack Club's implementation at https://github.com/hackclub/dns
  • Loading branch information
krishnans2006 committed Apr 14, 2024
1 parent d6fe769 commit 1a35651
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: deploy

on:
workflow_dispatch:
push:
branches:
- main

jobs:
octodns:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install dependencies
run: pip install -r requirements.txt

- name: Deploy to production
run: ./scripts/deploy.sh
env:
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }}
25 changes: 25 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: test

on:
push:
pull_request:

jobs:
octodns:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install dependencies
run: pip install -r requirements.txt

- name: Dry run
run: ./scripts/dry-run.sh
env:
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }}
23 changes: 23 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: validate

on:
push:
branches:
- main
pull_request:

permissions:
contents: read
pull-requests: write

jobs:
json-yaml-validate:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Validate YAML
uses: GrantBirki/[email protected]
with:
comment: "true"
3 changes: 3 additions & 0 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

octodns-sync --config-file=./config/produciton.yaml --doit
3 changes: 3 additions & 0 deletions scripts/dry-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

octodns-sync --config-file=./config/produciton.yaml

0 comments on commit 1a35651

Please sign in to comment.