-
Notifications
You must be signed in to change notification settings - Fork 21
94 lines (91 loc) · 2.73 KB
/
build-frontend.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: "[FRONTEND] Build"
on:
workflow_dispatch:
inputs:
tag:
description: "`x.y.z-front.NN` 형태로 버전을 입력해주세요. (ex. 0.1.0-front.05)"
required: true
default: 0.0.1-front.00
env:
TAG: ${{ github.event.inputs.tag }}
SLACK_WEBHOOK_URL: ${{secrets.SLACK_WEBHOOK_URL}}
FRONTEND_ECR_REPOSITORY: ${{ secrets.FRONTEND_ECR_REPOSITORY }}
BUILD_PATH: "~/humancat-frontend-build-tmp"
permissions:
id-token: write
contents: write
jobs:
condition_check:
runs-on: ubuntu-latest
steps:
- name: check tag format
run: |
if [[ !(${{ env.TAG }} =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\-front\.[0-9]{2}$) ]];
then
echo "You entered an incorrect tag format."
exit 1
fi
- name: notice when job fails
if: failure()
uses: 8398a7/[email protected]
with:
status: ${{job.status}}
fields: repo,workflow,job
author_name: Github Action Slack
tagging:
needs: condition_check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Create Tag
run: |
git tag ${{ env.TAG }}
git push origin ${{ env.TAG }}
- name: notice when job fails
if: failure()
uses: 8398a7/[email protected]
with:
status: ${{job.status}}
fields: repo,workflow,job
author_name: Github Action Slack
build:
needs: tagging
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Move Python Sample code
run: |
mkdir -p $BUILD_PATH
cp -rf source/humancat-frontend/* $BUILD_PATH/
cp -rf build/humancat-frontend/* $BUILD_PATH/
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.ASSUME_ROLE_ARN }}
aws-region: ap-northeast-2
role-session-name: GithubActionSession
- id: build-image
name: Build and Tag Image
env:
FRONTEND_ECR_REPOSITORY: ${{ env.FRONTEND_ECR_REPOSITORY }}
IMAGE_TAG: ${{ env.TAG }}
run: |
docker build -t $FRONTEND_ECR_REPOSITORY:$IMAGE_TAG $BUILD_PATH/
- id: login-ecr
name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v1
- id: push-image-to-aws-ecr
name: Push image to Amazon ECR
env:
FRONTEND_ECR_REPOSITORY: ${{ env.FRONTEND_ECR_REPOSITORY }}
IMAGE_TAG: ${{ env.TAG }}
run: |
docker push $FRONTEND_ECR_REPOSITORY:$IMAGE_TAG
- name: Notice when job fails
if: always()
uses: 8398a7/[email protected]
with:
status: ${{job.status}}
fields: repo,workflow,job
author_name: Github Action Slack