Skip to content

Commit ab45b9d

Browse files
chore(cicd): update deploy workflows
1 parent 6d617f7 commit ab45b9d

File tree

4 files changed

+20
-19
lines changed

4 files changed

+20
-19
lines changed

.github/workflows/deploy-vm-prod.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build Image, push to Registry and Deploy to Digital Ocean's PRD
1+
name: Build Image, push to Registry and Deploy to Digital Ocean's production environment
22

33
on:
44
push:
@@ -86,7 +86,7 @@ jobs:
8686
runs-on: ubuntu-latest
8787
if: github.event_name == 'push'
8888
steps:
89-
- uses: actions/checkout@v2
89+
- uses: actions/checkout@v4
9090
- name: Build image
9191
run: docker build . --build-arg AUTH_TOKEN=${{ secrets.AUTH_KEY }} --build-arg ALLOWED_HOSTS=${{ secrets.ALLOWED_HOSTS }} --file Dockerfile --tag ${{ secrets.IMAGE_NAME }}
9292
- name: Log into registry
@@ -117,9 +117,9 @@ jobs:
117117
needs: push-image-to-registry
118118
runs-on: ubuntu-latest
119119
steps:
120-
- uses: actions/checkout@prd
120+
- uses: actions/checkout@vm-deploy-prod
121121
- name: copy docker-compose.yml
122-
uses: appleboy/scp-action@prd
122+
uses: appleboy/scp-action@vm-deploy-prod
123123
with:
124124
host: ${{ secrets.HOST }}
125125
username: ${{ secrets.USERNAME }}
@@ -129,7 +129,7 @@ jobs:
129129
target: "image"
130130

131131
- name: execute docker-compose
132-
uses: appleboy/ssh-action@prd
132+
uses: appleboy/ssh-action@vm-deploy-prod
133133
env:
134134
SECRET_KEY: ${{ secrets.SECRET_KEY }}
135135
CDN_NAME: ${{ secrets.CDN_NAME }}

.github/workflows/deploy-vm-qa.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
name: Build Image, push to Registry and Deploy to HML
1+
name: Build Image, push to Registry and Deploy to Q.A.
22
on:
33
push:
4-
# Publish `hml` as Docker `latest` image.
4+
# Publish `qa` as Docker `latest` image.
55
branches:
66
- vm-deploy-qa
77

@@ -77,7 +77,7 @@ jobs:
7777
run: sudo apt-get install libmemcached-dev
7878
- name: Run tests
7979
run: |
80-
docker build . --build-arg AUTH_TOKEN=${{ secrets.HML_AUTH_KEY }} --build-arg ALLOWED_HOSTS=${{ secrets.HML_ALLOWED_HOSTS }} --file Dockerfile.hml
80+
docker build . --build-arg AUTH_TOKEN=${{ secrets.HML_AUTH_KEY }} --build-arg ALLOWED_HOSTS=${{ secrets.HML_ALLOWED_HOSTS }} --file Dockerfile
8181
8282
# Push image to GitHub Packages.
8383
# See also https://docs.docker.com/docker-hub/builds/
@@ -89,12 +89,12 @@ jobs:
8989
steps:
9090
- uses: actions/checkout@v4
9191
- name: Build image
92-
run: docker build . --build-arg AUTH_TOKEN=${{ secrets.HML_AUTH_KEY }} --build-arg GTAG_ID=${{ secrets.HML_GTAG_ID }} --build-arg ALLOWED_HOSTS=${{ secrets.HML_ALLOWED_HOSTS }} --file Dockerfile.hml --tag ${{ secrets.IMAGE_NAME }}-hml
92+
run: docker build . --build-arg AUTH_TOKEN=${{ secrets.HML_AUTH_KEY }} --build-arg GTAG_ID=${{ secrets.HML_GTAG_ID }} --build-arg ALLOWED_HOSTS=${{ secrets.HML_ALLOWED_HOSTS }} --file Dockerfile --tag ${{ secrets.IMAGE_NAME }}-qa
9393
- name: Log into registry
9494
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
9595
- name: Push image
9696
run: |
97-
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/${{ secrets.IMAGE_NAME }}-hml
97+
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/${{ secrets.IMAGE_NAME }}-qa
9898
9999
# Change all uppercase to lowercase
100100
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
@@ -106,31 +106,31 @@ jobs:
106106
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
107107
108108
# Use Docker `latest` tag convention
109-
[ "$VERSION" == "hml" ] && VERSION=latest
109+
[ "$VERSION" == "qa" ] && VERSION=latest
110110
111111
echo IMAGE_ID=$IMAGE_ID
112112
echo VERSION=$VERSION
113113
114-
docker tag ${{ secrets.IMAGE_NAME }}-hml $IMAGE_ID:$VERSION
114+
docker tag ${{ secrets.IMAGE_NAME }}-qa $IMAGE_ID:$VERSION
115115
docker push $IMAGE_ID:$VERSION
116116
117117
deploy:
118118
needs: push-image-to-registry
119119
runs-on: ubuntu-latest
120120
steps:
121-
- uses: actions/checkout@hml
122-
- name: copy docker-compose.hml.yml
123-
uses: appleboy/scp-action@hml
121+
- uses: actions/checkout@vm-deploy-qa
122+
- name: copy docker-compose.qa.yml
123+
uses: appleboy/scp-action@vm-deploy-qa
124124
with:
125125
host: ${{ secrets.HML_HOST }}
126126
username: ${{ secrets.USERNAME }}
127127
key: ${{ secrets.SSH_PRIVATE_KEY }}
128128
port: 22
129-
source: "docker-compose.hml.yml"
129+
source: "docker-compose.qa.yml"
130130
target: "image"
131131

132132
- name: execute docker-compose
133-
uses: appleboy/ssh-action@hml
133+
uses: appleboy/ssh-action@vm-deploy-qa
134134
env:
135135
SECRET_KEY: ${{ secrets.SECRET_KEY }}
136136
CDN_NAME: ${{ secrets.CDN_NAME }}
@@ -149,7 +149,7 @@ jobs:
149149
script: |
150150
docker login -u ${{ secrets.REGISTRY_USERNAME }} -p ${{ secrets.DEPLOY_TOKEN }} docker.pkg.github.com
151151
cd image
152-
mv docker-compose.hml.yml docker-compose.yml
152+
mv docker-compose.qa.yml docker-compose.yml
153153
docker-compose pull
154154
MODE=production SMTP_HOST_USER=${{ secrets.SMTP_HOST_USER }} SMTP_HOST_PASSWORD=${{ secrets.SMTP_HOST_PASSWORD }} SECRET_KEY=${{ secrets.SECRET_KEY }} CDN_NAME=${{ secrets.CDN_NAME }} CDN_API_KEY=${{ secrets.CDN_API_KEY }} CDN_API_SECRET=${{ secrets.CDN_API_SECRET }} DB_HOST=${{ secrets.DB_HOST }} DB_NAME=${{ secrets.DB_NAME }} DB_USER=${{ secrets.DB_USER }} DB_PASSWORD=${{ secrets.DB_PASSWORD }} DB_PORT=${{ secrets.DB_PORT }} docker-compose up -d
155155
docker image prune -f
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: "3"
33
services:
44
web:
55
restart: always
6-
image: docker.pkg.github.com/marcelovicentegc/django-react-typescript/django-react-typescript-hml:latest
6+
image: docker.pkg.github.com/marcelovicentegc/django-react-typescript/django-react-typescript-qa:latest
77
expose:
88
- "8000"
99
ports:

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ services:
1010
- "8000:8000"
1111
links:
1212
- postgres:postgres
13+
- memcached:memcached
1314
environment:
1415
SECRET_KEY: ${SECRET_KEY}
1516
DB_HOST: ${DB_HOST}

0 commit comments

Comments
 (0)