-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (63 loc) · 2.31 KB
/
prod.yaml
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
name: 프로덕션 워크플로우
on:
push:
branches: [ 'main' ]
env:
ENVIRONMENT: production
IMAGE_NAME: no5ing/webview-was
SERVICE_NAME: webview-prod_webview-prod
concurrency:
group: production
jobs:
prepare-variables:
name: 환경변수 준비하기
runs-on: ubuntu-latest
outputs:
image-tag: ${{ steps.setup-env.outputs.image-tag }}
environment: ${{ steps.setup-env.outputs.environment }}
image-name: ${{ steps.setup-env.outputs.image-name }}
service-name: ${{ steps.setup-env.outputs.service-name }}
steps:
- name: GitHub 에서 레포 받아오기
uses: actions/checkout@v3
- name: 환경변수 출력하기
id: setup-env
run: |
echo "image-tag=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "environment=$ENVIRONMENT" >> $GITHUB_OUTPUT
echo "image-name=$IMAGE_NAME" >> $GITHUB_OUTPUT
echo "service-name=$SERVICE_NAME" >> $GITHUB_OUTPUT
call-build-workflow:
if: github.event_name == 'push'
needs: [ prepare-variables ]
name: 이미지 빌드
uses: ./.github/workflows/build.yaml
permissions:
id-token: write
contents: read
with:
image-tag: ${{ needs.prepare-variables.outputs.image-tag }}
image-name: ${{ needs.prepare-variables.outputs.image-name }}
secrets:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
call-deploy-workflow:
if: github.event_name == 'push'
needs: [ prepare-variables, call-build-workflow ]
name: 서비스 배포
uses: ./.github/workflows/deploy.yaml
permissions:
id-token: write
contents: read
secrets:
REMOTE_SSH_HOST: ${{ secrets.REMOTE_SSH_HOST }}
REMOTE_SSH_USERNAME: ${{ secrets.REMOTE_SSH_USERNAME }}
REMOTE_SSH_KEY: ${{ secrets.REMOTE_SSH_KEY }}
REMOTE_SSH_PASSPHRASE: ${{ secrets.REMOTE_SSH_PASSPHRASE }}
REMOTE_SSH_PORT: ${{ secrets.REMOTE_SSH_PORT }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
image-tag: ${{ needs.prepare-variables.outputs.image-tag }}
environment: ${{ needs.prepare-variables.outputs.environment }}
image-name: ${{ needs.prepare-variables.outputs.image-name }}
service-name: ${{ needs.prepare-variables.outputs.service-name }}