Init #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: branch-deploy | |
on: | |
issue_comment: | |
types: [ created ] | |
# Permissions needed for reacting and adding comments for IssueOps commands | |
permissions: | |
pull-requests: write | |
deployments: write | |
contents: write | |
checks: read | |
jobs: | |
branch-deploy: | |
name: branch-deploy | |
if: # only run on pull request comments and very specific comment body string as defined in our branch-deploy settings | |
${{ github.event.issue.pull_request && | |
(startsWith(github.event.comment.body, '.deploy') || | |
startsWith(github.event.comment.body, '.noop') || | |
startsWith(github.event.comment.body, '.lock') || | |
startsWith(github.event.comment.body, '.help') || | |
startsWith(github.event.comment.body, '.wcid') || | |
startsWith(github.event.comment.body, '.unlock')) }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: branch-deploy | |
id: branch-deploy | |
uses: github/branch-deploy@v9 | |
with: | |
trigger: ".deploy" | |
environment: production | |
environment_targets: production | |
production_environments: production | |
sticky_locks: "true" | |
admins: "GrantBirki" | |
- name: checkout | |
if: steps.branch-deploy.outputs.continue == 'true' | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ steps.branch-deploy.outputs.ref }} | |
- uses: actions/setup-python@v5 | |
if: steps.branch-deploy.outputs.continue == 'true' | |
with: | |
python-version: '3.10' | |
cache: 'pip' | |
- name: install requirements | |
if: steps.branch-deploy.outputs.continue == 'true' | |
run: pip install -r requirements.txt | |
# production deployment - noop only | |
- uses: grantbirki/octodns-action@v1 | |
if: ${{ steps.branch-deploy.outputs.continue == 'true' && steps.branch-deploy.outputs.noop == 'true' }} | |
with: | |
config_path: production.yaml | |
doit: '' | |
add_pr_comment: 'Yes' | |
pr_comment_token: ${{ github.token }} | |
comments_url: "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments" | |
env: | |
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }} | |
# production deployment - non-noop | |
- uses: grantbirki/octodns-action@v1 | |
if: ${{ steps.branch-deploy.outputs.continue == 'true' && steps.branch-deploy.outputs.noop != 'true' }} | |
with: | |
config_path: production.yaml | |
doit: '--doit' | |
add_pr_comment: 'Yes' | |
pr_comment_token: ${{ github.token }} | |
comments_url: "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments" | |
env: | |
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }} |