-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (54 loc) · 2.06 KB
/
deploy-app.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
name: Deploy App
on:
push:
branches:
- "trunk"
jobs:
build-server:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Authenticate package registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login https://ghcr.io -u ${GITHUB_ACTOR} --password-stdin
- name: Get tag
run: echo "BUILD_TAG=$(git describe --tags)" >> $GITHUB_ENV
- name: Build and tag image
run: docker build -f server/Dockerfile -t ghcr.io/dellisd/reroute-server:${BUILD_TAG} -t ghcr.io/dellisd/reroute-server:dev .
- name: Push image
if: success()
run: docker push --all-tags ghcr.io/dellisd/reroute-server
build-client:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Secrets
env:
MAPBOX_KEY: ${{ secrets.MAPBOX_KEY }}
run: echo "mapbox.key=$MAPBOX_KEY" >> local.properties
- name: Authenticate package registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login https://ghcr.io -u ${GITHUB_ACTOR} --password-stdin
- name: Get tag
run: echo "BUILD_TAG=$(git describe --tags)" >> $GITHUB_ENV
- name: Build and tag image
run: docker build -f web/Dockerfile -t ghcr.io/dellisd/reroute-client:${BUILD_TAG} -t ghcr.io/dellisd/reroute-client:dev .
- name: Push image
if: success()
run: docker push --all-tags ghcr.io/dellisd/reroute-client
deploy:
runs-on: ubuntu-latest
needs: [build-server, build-client]
steps:
- name: Deploy 🚉
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.DOCKER_SSH_PRIVATE_KEY }}
script: |
docker pull ghcr.io/dellisd/reroute-server:dev
docker pull ghcr.io/dellisd/reroute-client:dev
docker stack deploy -c ${{ secrets.DOCKER_DEPLOY_PATH }}/docker-compose.yml reroute --with-registry-auth