diff --git a/examples/README.md b/examples/README.md index d623656..d991890 100644 --- a/examples/README.md +++ b/examples/README.md @@ -1,8 +1,6 @@ # Examples -Find in [main.workflow](main.workflow) an example workflow: +Find in this folder two GitHub Actions workflow examples. -1. Lint the `dnsconfig.js` configuration file using ESLint. -1. Preview the DNS changes. -1. Check whether the current branch is `master`, otherwise abort. -1. Deploy the DNS changes. +* [deploy-master.yml](deploy-master.yml): On merge into master, deploy the DNS configuration. +* [test-pull-request.yml](test-pull-request.yml): Lint the `dnsconfig.js` configuration file using ESLint, and preview the DNS changes. diff --git a/examples/deploy-master.yml b/examples/deploy-master.yml new file mode 100644 index 0000000..de173e1 --- /dev/null +++ b/examples/deploy-master.yml @@ -0,0 +1,21 @@ +--- +name: deploy + +on: + push: + branches: + - master + +jobs: + dnscontrol: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + + - name: DNSControl push + uses: koenrh/dnscontrol-action@master + env: + CLOUDFLARE_API_KEY: ${{ secrets.CLOUDFLARE_API_KEY }} + CLOUDFLARE_API_USER: ${{ secrets.CLOUDFLARE_API_USER }} + with: + args: push diff --git a/examples/main.workfow b/examples/main.workfow deleted file mode 100644 index fe5c5ff..0000000 --- a/examples/main.workfow +++ /dev/null @@ -1,29 +0,0 @@ -workflow "Deploy DNS" { - on = "push" - resolves = ["DNSControl push"] -} - -action "ESLint" { - uses = "koenrh/actions/eslint@4bd28abf67573a1b21b0efa07d2fbbc04b32c6af" - args = "dnsconfig.js" -} - -action "DNSControl preview" { - uses = "koenrh/dnscontrol-action@ec8e8a39a250ccb4368ce9de4888db9511b61740" - args = "preview" - needs = ["ESLint"] - secrets = ["CLOUDFLARE_API_USER", "CLOUDFLARE_API_KEY"] -} - -action "Branch filter" { - uses = "actions/bin/filter@b2bea0749eed6beb495a8fa194c071847af60ea1" - args = "branch master" - needs = ["DNSControl preview"] -} - -action "DNSControl push" { - uses = "koenrh/dnscontrol-action@ec8e8a39a250ccb4368ce9de4888db9511b61740" - needs = ["Branch filter"] - args = "push" - secrets = ["CLOUDFLARE_API_KEY", "CLOUDFLARE_API_USER"] -} diff --git a/examples/test-pull-request.yml b/examples/test-pull-request.yml new file mode 100644 index 0000000..f101bf5 --- /dev/null +++ b/examples/test-pull-request.yml @@ -0,0 +1,30 @@ +--- +name: Test + +on: pull_request + +jobs: + eslint: + name: ESLint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + + - name: Run ESLint + uses: koenrh/actions/eslint@master + with: + args: dnsconfig.js + + dnscontrol: + name: DNSControl + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + + - name: Preview + uses: koenrh/dnscontrol-action@master + env: + CLOUDFLARE_API_KEY: ${{ secrets.CLOUDFLARE_API_KEY }} + CLOUDFLARE_API_USER: ${{ secrets.CLOUDFLARE_API_USER }} + with: + args: preview