Skip to content

Set up CI job for deployment with dokku #2441

Set up CI job for deployment with dokku

Set up CI job for deployment with dokku #2441

Workflow file for this run

name: CI
on: push
jobs:
build:
uses: kausaltech/github-actions/.github/workflows/build.yaml@main
with:
project_id: watch-ui
project_type: nextjs
secrets:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
test:
needs: [build]
uses: ./.github/workflows/e2e-image.yaml
with:
image: ${{ needs.build.outputs.image }}:${{ needs.build.outputs.image_tag }}
instance_identifiers: sunnydale
backend_base_url: https://api.watch.kausal.tech/v1
build_id: ${{ needs.build.outputs.build_id }}
s3_endpoint: ${{ vars.BUILD_S3_ENDPOINT }}
s3_bucket: ${{ vars.BUILD_S3_BUCKET }}
secrets: inherit
deploy:
needs: [build]
uses: kausaltech/github-actions/.github/workflows/deploy.yaml@main
secrets:
gitops_pat: ${{ secrets.GHA_GITOPS_PAT }}
if: needs.build.outputs.deployment_env
with:
docker_image_repo: ${{ needs.build.outputs.image }}
docker_image_tag: ${{ needs.build.outputs.image_tag }}
project_id: watch-ui
build_id: ${{ needs.build.outputs.build_id }}
deployment_env: ${{ needs.build.outputs.deployment_env }}
dokku-deploy:
needs: [build, deploy]
# FIXME: Should be configurable
if: needs.build.outputs.deployment_env == 'production' && vars.DOKKU_DEPLOY_PRODUCTION_GIT_URL != ''
runs-on: runner-prod
container:
image: dokku/ci-docker-image:latest
steps:
- name: Push to dokku
run: dokku-deploy
env:
GIT_REMOTE_URL: ${{ vars.DOKKU_DEPLOY_PRODUCTION_GIT_URL }}
SSH_PRIVATE_KEY: ${{ secrets.DOKKU_SSH_PRIVATE_KEY }}
DEPLOY_DOCKER_IMAGE: ${{ needs.build.outputs.image }}:${{ needs.build.outputs.image_tag }}
# For debugging
# TRACE: '1'