-
Notifications
You must be signed in to change notification settings - Fork 1
87 lines (76 loc) · 2.66 KB
/
climatemappedafrica-deploy-dev.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Climate Mapped Africa | Deploy | DEV
on:
push:
branches:
- main
- chore/arm-build
paths:
- "apps/climatemappedafrica/**"
- "Dockerfile"
- ".github/workflows/climatemappedafrica-deploy-dev.yml"
concurrency:
group: "${{ github.workflow }} @ ${{ github.ref }}"
cancel-in-progress: true
env:
DOKKU_REMOTE_BRANCH: "master"
DOKKU_REMOTE_URL: "ssh://azureuser@ui-1.dev.codeforafrica.org"
IMAGE_NAME: "codeforafrica/climatemappedafrica-ui"
NEXT_PUBLIC_APP_URL: "https://climatemapped-africa-ui.dev.codeforafrica.org"
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
APP_NAME: climatemapped-africa-ui
jobs:
deploy:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [20.16]
os: [ubuntu-latest]
steps:
- name: Cloning repo
uses: actions/checkout@v3
with:
fetch-depth: 0
# Add support for more platforms with QEMU (optional)
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Cache Docker layers
uses: actions/cache@v3
with:
key: ${{ runner.os }}-buildx-${{ github.sha }}
path: /tmp/.buildx-cache
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to DockerHub
uses: docker/login-action@v2
with:
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
username: ${{ secrets.DOCKER_HUB_USERNAME }}
- name: Build Docker image
uses: docker/build-push-action@v3
with:
build-args: |
HURUMAP_API_URL=${{ secrets.CLIMATEMAPPEDAFRICA_HURUMAP_API_URL }}
MONGO_URL=${{ secrets.CLIMATEMAPPEDAFRICA_MONGO_URL }}
PAYLOAD_SECRET=${{ secrets.CLIMATEMAPPEDAFRICA_PAYLOAD_SECRET }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
context: .
platforms: linux/amd64,linux/arm64
target: climatemappedafrica-runner
push: true
tags: "${{ env.IMAGE_NAME }}:${{ github.sha }}"
# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Push to Dokku
uses: dokku/github-action@v1.4.0
with:
git_remote_url: ${{ env.DOKKU_REMOTE_URL }}/${{ env.APP_NAME }}
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
deploy_docker_image: ${{ env.IMAGE_NAME }}:${{ github.sha }}