-
Notifications
You must be signed in to change notification settings - Fork 155
67 lines (59 loc) · 2 KB
/
main.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
# Read more about setting it up
# https://medium.com/@ljmocic/deploying-react-application-to-aws-s3-using-github-actions-85addacaeace
name: fastapi-sqlmodel-alembic
on:
# Trigger the workflow on push or pull request,
# but only for the master branch
push:
branches: [ main ]
tags:
- 'v*'
#pull_request:
# branches: [ main ]
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: jrtec/fastapi-alembic-sqlmodel-async
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: ./backend
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build:
name: Build phase
runs-on: ubuntu-latest
needs: push_to_registry
steps:
- name: Clone repository
id: clone-repository
uses: actions/checkout@main
- name: Generate deployment package
id: generate-deployment-package
run: zip -r deploy.zip . -x '*.git*'
- name: Deploy to EB
id: deploy2b
uses: einaregilsson/beanstalk-deploy@v21
with:
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
application_name: ${{ secrets.AWS_APPLICATION_NAME }}
environment_name: ${{ secrets.AWS_ENVIRONMENT_NAME }}
version_label: v0.1.${{ github.run_number }}
# use_existing_version_if_available: True
region: ${{ secrets.AWS_REGION }}
deployment_package: deploy.zip