-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (85 loc) Β· 2.88 KB
/
ci.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: Push to ECR
on:
push:
branches: [ "feature/codepipeline" ]
env:
AWS_REGION: ap-northeast-2
ECR_REGISTRY: 654654448479.dkr.ecr.ap-northeast-2.amazonaws.com
ECR_REPOSITORY: repick-repo
ZIP_FILE_NAME: deploy-package.zip
permissions:
contents: read
jobs:
build:
name: CI
runs-on: ubuntu-latest
environment: production
steps:
- name: Checkout
uses: actions/checkout@v4
#
# - name: Make application-secret.yml and set secrets
# run: |
# mkdir -p ./src/main/resources
# mkdir -p ./src/main/resources/key
# if [ -f ./src/main/resources/application.yml ]; then
# rm ./src/main/resources/application.yml
# fi
# touch ./src/main/resources/application.yml
# touch ./src/main/resources/${{ secrets.APPLE_AUTH_KEY_ID }}.p8
# echo "${{ secrets.APPLICATION_SECRET }}" > ./src/main/resources/application.yml
# echo "${{ secrets.APPLE_AUTH_KEY }}" > ./src/main/resources/key/${{ secrets.APPLE_AUTH_KEY_ID }}.p8
#
# - name: Set up JDK 17
# uses: actions/setup-java@v4
# with:
# java-version: '17'
# distribution: 'temurin'
#
# ## gradle build
# - name: Build with Gradle
# run: ./gradlew bootJar
#
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
#
# - name: Login to Amazon ECR
# id: login-ecr
# uses: aws-actions/amazon-ecr-login@v2
# with:
# mask-password: true
#
# - name: Build, tag, and push image to Amazon ECR
# id: build-image
# run: |
# docker build -t $ECR_REGISTRY/$ECR_REPOSITORY .
# docker push $ECR_REGISTRY/$ECR_REPOSITORY
#
- name: Zip deployment files
run: |
zip -r ${{ env.ZIP_FILE_NAME }} ./aws/
- name: Upload AppSpec and scripts to S3
run: |
aws s3 cp ${{ env.ZIP_FILE_NAME }} s3://${{ secrets.S3_BUCKET }}/${{ env.ZIP_FILE_NAME }}
deploy:
needs: build
name: Trigger CD (CodeDeploy)
runs-on: ubuntu-latest
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Trigger CodeDeploy
run: |
aws deploy create-deployment \
--application-name repick-codedeploy-app \
--deployment-group-name repick-codedeploy-deployment-group \
--s3-location bucket=${{ secrets.S3_BUCKET }},bundleType=zip,key=${{ env.ZIP_FILE_NAME }} \
--file-exists-behavior OVERWRITE