-
Notifications
You must be signed in to change notification settings - Fork 1
86 lines (70 loc) · 2.83 KB
/
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
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
name: Deploy to AWS CodeDeploy
on:
push:
branches:
- deploy
env:
S3_BUCKET_NAME: sursim-img
APPLICATION_NAME: boomerang
DEPLOYMENT_GROUP_NAME: boomerang-deploy-group
REGION: ap-northeast-2
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
- name: Create application.properties from Secrets
working-directory: ./boomerang
run: |
echo "Current directory: $(pwd)"
mkdir -p src/main/resources
echo "${{ secrets.APPLICATION }}" > src/main/resources/application.properties
cat src/main/resources/application.properties
- name: Grant execute permission for gradlew
working-directory: ./boomerang
run: chmod +x ./gradlew
- name: Build with Gradle
working-directory: ./boomerang
run: ./gradlew build -x test
- name: Convert Windows line endings to Unix line endings
run: |
# Convert Windows line endings to Unix line endings for all scripts in the 'scripts' directory
find ./scripts -type f -name "*.sh" -exec sed -i 's/\r$//' {} \;
- name: Make zip file including appspec.yml
run: |
# Ensure appspec.yml is included in the zip
cp appspec.yml ./boomerang/
cp -r ./boomerang/build/libs ./boomerang/ # Copy libs folder
cp -r ./scripts ./boomerang/ # Copy scripts folder
# Create fonts directory in the deployment package
mkdir -p ./boomerang/fonts
cp -r ./boomerang/src/main/resources/fonts/* ./boomerang/fonts/
chmod +x ./boomerang/scripts/*.sh # Grant execute permissions to all .sh files
cd ./boomerang
zip -r ../application.zip .
cd ..
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.REGION }}
- name: Upload to S3
run: aws s3 cp application.zip s3://$S3_BUCKET_NAME/application.zip
- name: List objects in S3 bucket
run: aws s3 ls s3://$S3_BUCKET_NAME/ # List objects in the S3 bucket
- name: Deploy with CodeDeploy
run: |
aws deploy create-deployment \
--application-name $APPLICATION_NAME \
--deployment-config-name CodeDeployDefault.AllAtOnce \
--deployment-group-name $DEPLOYMENT_GROUP_NAME \
--file-exists-behavior OVERWRITE \
--s3-location bucket=$S3_BUCKET_NAME,bundleType=zip,key=application.zip \
--region $REGION