Skip to content

Commit

Permalink
Edit ci cd for deploying in prod
Browse files Browse the repository at this point in the history
  • Loading branch information
leihuayi committed Aug 21, 2023
1 parent 7f19265 commit daeb69b
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions .github/workflows/release.yml → .github/workflows/prod.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI for release
name: CI for prod deployment
on:
push:
tags:
Expand All @@ -22,10 +22,17 @@ jobs:

build-push:
runs-on: ubuntu-latest
outputs:
branch: ${{ steps.get_branch.outputs.branch }}
steps:
- uses: actions/checkout@v2
- name: Build the Docker image
run: make CONTINUE=y build-prod
- name: Test running the docker containers
run: |
make CONTINUE=y up-prod
./infra/scripts/test-alive.sh localhost
make down-prod
- name: Login to GHCR
if: success()
uses: docker/login-action@v1
Expand Down Expand Up @@ -54,31 +61,36 @@ jobs:
container: basegun/basegun-frontend
dry-run: false
untagged: true
- name: Get branch
id: get_branch
run: |
raw=$(git branch -r --contains ${{ github.ref }})
branch=${raw##*/}
echo "{name}=branch" >> $GITHUB_OUTPUT
echo "Branch is $branch."
deploy-prod:
uses: ./.github/workflows/deploy.yml
uses: ./.github/workflows/change-values-kube.yml
needs: build-push
with:
image_version: "latest"
branch: "main"
volume_size: 10
flavor: "b2-7"
workspace: "prod"
branch: ${{ needs.check.outputs.branch }}
namespace: basegun-prod
domain: basegun.fr
secrets:
API_OVH_TOKEN: ${{ secrets.API_OVH_TOKEN }}
SERVER_IP: ${{ secrets.PROD_SERVER_IP }}
OS_PASSWORD: ${{ secrets.OS_PASSWORD }}
OS_PROJECT_ID: ${{ secrets.OS_PROJECT_ID }}
OS_PROJECT_NAME: ${{ secrets.OS_PROJECT_NAME }}
OS_USERNAME: ${{ secrets.OS_USERNAME }}
X_OVH_TOKEN: ${{ secrets.PROD_OVH_TOKEN }}
JOB_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
KUBECONFIG: ${{ secrets.PROD_K8_CONFIG }}

test:
runs-on: ubuntu-latest
needs: deploy-prod
needs: deploy-preprod
steps:
- uses: actions/checkout@v2
- name: Test DNS
if: success()
run : |
./infra/scripts/test-alive.sh basegun.fr
./infra/scripts/test-alive.sh preprod.basegun.fr

0 comments on commit daeb69b

Please sign in to comment.