Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

Update README.md

Update README.md #39

Workflow file for this run

name: pesayetu.pesacheck.org | Build and Deploy
on:
push:
branches: [main]
env:
DOKKU_REMOTE_BRANCH: "master"
DOKKU_REMOTE_URL: "ssh://[email protected]/pesayetu-ui"
IMAGE_NAME: "codeforafrica/pesayetu"
NEXT_PUBLIC_APP_URL: "https://pesayetu.pesacheck.org"
NEXT_PUBLIC_IMAGE_DOMAINS: "pesayetu.cms.dev.codeforafrica.org, cms.dev.codeforafrica.org, hurumap-v2.s3.amazonaws.com"
NEXT_PUBLIC_OPENAFRICA_DOMAINS: "open.africa,openafrica.net,africaopendata.org"
NEXT_PUBLIC_SOURCEAFRICA_DOMAINS: "dc.sourceafrica.net"
WORDPRESS_URL: "https://cms.dev.codeforafrica.org/pesayetu/"
WORDPRESS_MULTISITE_PREFIX: "/pesayetu"
GIT_PUSH_FLAGS: "--force"
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
# Set up Node since it's required by version-check
# https://github.com/EndBug/version-check#github-workflow
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: "16"
- name: Check if version is bumped
id: version-check
uses: EndBug/version-check@v2
with:
# Whether to search in every commit's diff.
# This is useful if you often do change the version without saying it
# in the commit message. If you always include the semver of the new
# version in your commit message when you bump versions then you can
# omit this.
diff-search: true
- name: Set up Docker Buildx
if: steps.version-check.outputs.changed == 'true'
uses: docker/setup-buildx-action@v2
- name: Cache Docker layers
if: steps.version-check.outputs.changed == 'true'
uses: actions/cache@v3
with:
key: ${{ runner.os }}-buildx-${{ github.sha }}
path: /tmp/.buildx-cache
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to DockerHub
if: steps.version-check.outputs.changed == 'true'
uses: docker/login-action@v2
with:
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
username: ${{ secrets.DOCKER_HUB_USERNAME }}
- name: Build Docker image
if: steps.version-check.outputs.changed == 'true'
uses: docker/build-push-action@v3
with:
build-args: |
WORDPRESS_URL=${{ env.WORDPRESS_URL }}
WORDPRESS_APPLICATION_USERNAME=${{ secrets.WORDPRESS_APPLICATION_USERNAME }}
WORDPRESS_APPLICATION_PASSWORD=${{ secrets.WORDPRESS_APPLICATION_PASSWORD }}
WORDPRESS_MULTISITE_PREFIX=${{ env.WORDPRESS_MULTISITE_PREFIX }}
NEXT_PUBLIC_APP_URL=${{ env.NEXT_PUBLIC_APP_URL }}
NEXT_PUBLIC_IMAGE_DOMAINS=${{ env.NEXT_PUBLIC_IMAGE_DOMAINS }}
NEXT_PUBLIC_OPENAFRICA_DOMAINS=${{ env.NEXT_PUBLIC_OPENAFRICA_DOMAINS }}
NEXT_PUBLIC_SOURCEAFRICA_DOMAINS=${{ env.NEXT_PUBLIC_SOURCEAFRICA_DOMAINS }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
context: .
push: true
tags: "${{ env.IMAGE_NAME }}:${{ steps.version-check.outputs.version }}"
- name: Move cache
if: steps.version-check.outputs.changed == 'true'
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Push to Dokku
if: steps.version-check.outputs.changed == 'true'
uses: dokku/[email protected]
with:
branch: ${{ env.DOKKU_REMOTE_BRANCH }}
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
git_push_flags: ${{ env.GIT_PUSH_FLAGS }}
git_remote_url: ${{ env.DOKKU_REMOTE_URL }}