-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (86 loc) · 2.92 KB
/
build-and-deploy.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
88
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions
name: Deploy Stack
on:
push:
branches:
- "main"
workflow_dispatch:
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
jobs:
test-api:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Test api
working-directory: ./catchemall/web-api
run: ./test.sh
test-ui:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Test api
working-directory: ./catchemall/ui
run: ./test.sh
build-push-api:
needs: test-api
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Log in to registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.CONTAINER_USERNAME }}
password: ${{ secrets.CONTAINER_PASSWORD }}
- name: Web Api - Build and Push
uses: docker/build-push-action@v3
with:
push: true
tags: ${{ secrets.REPOSITORY_NAME }}/catchemall-api:${{ github.sha }}, ${{ secrets.REPOSITORY_NAME }}/catchemall-api
context: ./catchemall/web-api
file: ./catchemall/web-api/Dockerfile
build-push-ui:
runs-on: ubuntu-22.04
needs: test-ui
steps:
- uses: actions/checkout@v3
- name: Log in to registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.CONTAINER_USERNAME }}
password: ${{ secrets.CONTAINER_PASSWORD }}
- name: UI - Build and Push
uses: docker/build-push-action@v3
with:
push: true
tags: ${{ secrets.REPOSITORY_NAME }}/catchemall-ui:${{ github.sha }}, ${{ secrets.REPOSITORY_NAME }}/catchemall-ui
context: ./catchemall/ui
file: ./catchemall/ui/Dockerfile
deploy:
needs: [build-push-api, build-push-ui]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: superfly/flyctl-actions/setup-flyctl@master
- name: Log in to registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.CONTAINER_USERNAME }}
password: ${{ secrets.CONTAINER_PASSWORD }}
- run: |
docker pull ${{ secrets.REPOSITORY_NAME }}/catchemall-ui:${{ github.sha }}
docker pull ${{ secrets.REPOSITORY_NAME }}/catchemall-api:${{ github.sha }}
- name: deploy ui
run: |
flyctl deploy --image ${{ secrets.REPOSITORY_NAME }}/catchemall-ui:${{ github.sha }} \
--local-only catchemall/ui \
--image-label ${{ github.ref_name }}
- name: deploy webapi
run: |
flyctl deploy --image ${{ secrets.REPOSITORY_NAME }}/catchemall-api:${{ github.sha }} \
--local-only catchemall/web-api \
--image-label ${{ github.ref_name }}