-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgo.yml
More file actions
68 lines (60 loc) · 2.1 KB
/
go.yml
File metadata and controls
68 lines (60 loc) · 2.1 KB
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
name: Deploy to Elastic Beanstalk - Go Application
on:
push:
branches: [main]
workflow_dispatch:
env:
AWS_REGION: us-east-2
APPLICATION_NAME: go-app
ENVIRONMENT_NAME: go-app-env
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Set up Go
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
with:
go-version: '1.21'
- name: Build Go binary for Linux
run: |
GOOS=linux GOARCH=amd64 go build -o application application.go
- name: Create deployment package
run: |
zip -r app.zip application Procfile public/ .ebextensions/
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: ${{ env.AWS_REGION }}
- name: Deploy to Elastic Beanstalk
uses: aws-actions/aws-elasticbeanstalk-deploy@v1.0.0
with:
aws-region: ${{ env.AWS_REGION }}
application-name: ${{ env.APPLICATION_NAME }}
environment-name: ${{ env.ENVIRONMENT_NAME }}
version-label: go-${{ github.sha }}
solution-stack-name: '64bit Amazon Linux 2023 v4.3.0 running Go 1'
deployment-package-path: app.zip
option-settings: |
[
{
"Namespace": "aws:autoscaling:launchconfiguration",
"OptionName": "IamInstanceProfile",
"Value": "aws-elasticbeanstalk-ec2-role"
},
{
"Namespace": "aws:elasticbeanstalk:environment",
"OptionName": "ServiceRole",
"Value": "aws-elasticbeanstalk-service-role"
},
{
"Namespace": "aws:ec2:instances",
"OptionName": "InstanceTypes",
"Value": "t3.small"
}
]