Just trigger on pushes to the betabooru branch instead of on the Docker image being built. The workflow_run event keeps triggering on the master branch even though it's supposed to only trigger on the betabooru branch. This makes it fail because it doesn't have access to the secrets in the betabooru environment. This does mean the deploy will fail if the image hasn't been previously built by a push to master first.
44 lines
1.3 KiB
YAML
44 lines
1.3 KiB
YAML
# Deploy the site to https://betabooru.donmai.us on every push to the `betabooru` branch.
|
|
|
|
name: Deploy Betabooru
|
|
|
|
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#permissions
|
|
permissions: read-all
|
|
|
|
on:
|
|
# https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_run
|
|
workflow_dispatch:
|
|
push:
|
|
branches: [betabooru]
|
|
|
|
jobs:
|
|
deploy-betabooru:
|
|
runs-on: ubuntu-latest
|
|
|
|
# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#concurrency
|
|
concurrency: deploy-betabooru
|
|
|
|
# The Kubernetes API credentials are kept in the betabooru environment.
|
|
# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idenvironment
|
|
environment:
|
|
name: betabooru
|
|
url: https://betabooru.donmai.us
|
|
|
|
steps:
|
|
# https://github.com/marketplace/actions/kubectl-tool-installer
|
|
- name: Install Kubectl
|
|
uses: azure/setup-kubectl@v1
|
|
with:
|
|
version: v1.21.5
|
|
|
|
- name: Configure Kubectl
|
|
run: |
|
|
mkdir -p ~/.kube
|
|
echo "$KUBECONFIG_YAML" > ~/.kube/config
|
|
env:
|
|
KUBECONFIG_YAML: ${{secrets.KUBECONFIG_YAML}}
|
|
|
|
- name: Deploy to Betabooru
|
|
run: |
|
|
kubectl rollout restart deploy/betabooru
|