-
Notifications
You must be signed in to change notification settings - Fork 1
57 lines (54 loc) · 1.96 KB
/
front_and_call_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
name: Codepet push front and call deploy
on:
push:
branches:
- 'develop'
- 'QA'
workflow_dispatch:
jobs:
build_and_push_to_docker_hub_frontend:
name: Push Docker image to DockerHub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Extract branch name
id: extract_branch
run: |
BRANCH_NAME=${GITHUB_REF#refs/heads/}
BRANCH_NAME=$(echo "$BRANCH_NAME" | tr '[:upper:]' '[:lower:]')
echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT
- name: Push to DockerHub
uses: docker/build-push-action@v5
with:
context: ./
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.PROJECT_NAME }}_frontend_${{ steps.extract_branch.outputs.branch_name }}:latest
build-args: |
NEXT_PUBLIC_CAPTCHA_SITE_KEY=${{ secrets.NEXT_PUBLIC_CAPTCHA_SITE_KEY }}
NEXT_PUBLIC_BASE_DEV_URL=${{ secrets.NEXT_PUBLIC_BASE_DEV_URL }}
NEXT_PUBLIC_BASE_TEST_URL=${{ secrets.NEXT_PUBLIC_BASE_TEST_URL }}
NEXT_PUBLIC_BASE_URL=${{ secrets[format('DOMAIN_{0}', github.ref_name)] }}
deploy_uses_other_file_from_develop:
if: github.ref == 'refs/heads/develop'
uses: Pet-projects-CodePET/Backend/.github/workflows/deploy.yml@develop
needs:
- build_and_push_to_docker_hub_frontend
with:
environment: dev
secrets: inherit
deploy_uses_other_file_from_QA:
if: github.ref == 'refs/heads/QA'
uses: Pet-projects-CodePET/Backend/.github/workflows/deploy.yml@develop
needs:
- build_and_push_to_docker_hub_frontend
with:
environment: prod
secrets: inherit