-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (46 loc) · 1.55 KB
/
Copy pathmain.yaml
File metadata and controls
59 lines (46 loc) · 1.55 KB
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
name: CI Deployment
on:
push:
branches:
- 'main'
- 'dev'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Free disk space on runner
uses: jlumbroso/free-disk-space@v1.3.1
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: true
swap-storage: true
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: 'Login to GitHub Container Registry'
run: echo ${{secrets.REGISTRY_PASSWORD}} | docker login ${{secrets.REGISTRY_HOST}} --username ${{secrets.REGISTRY_USERNAME}} --password-stdin
- name: Copy production env file
if: github.ref == 'refs/heads/main'
run: |
echo ${{ secrets.ENV_PRODUCTION }} | base64 -d > .env
cp .env .env.staging
- name: Copy staging env file
if: github.ref == 'refs/heads/dev'
run: |
echo ${{ secrets.ENV_STAGING }} | base64 -d > .env.staging
cp .env.staging .env
- name: Production Deploy
if: github.ref == 'refs/heads/main'
run: |
docker build -t ${{ secrets.REGISTRY_HOST }}/keepsimple-next:prod .
docker push ${{ secrets.REGISTRY_HOST }}/keepsimple-next:prod
- name: Staging Deploy
if: github.ref == 'refs/heads/dev'
run: |
docker build -t ${{ secrets.REGISTRY_HOST }}/keepsimple-next:staging .
docker push ${{ secrets.REGISTRY_HOST }}/keepsimple-next:staging