-
-
Notifications
You must be signed in to change notification settings - Fork 5
82 lines (69 loc) · 2.25 KB
/
dev-push.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
name: dev-push
on:
push:
branches:
- 'dev'
env:
PIPELINE_ID: ${{ github.run_id }}-${{ github.run_number }}
TEST_TAG: dbhive/main-prod:test
LATEST_TAG: dbhive/main-prod:latest
TEST_DB: ${{ secrets.TEST_DB }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- 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_ACCESS_KEY_SECRET }}
aws-region: us-west-2
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build and export to Docker
uses: docker/build-push-action@v4
with:
context: .
load: true
tags: ${{ env.TEST_TAG }}
- name: Test
run: docker-compose -f docker-compose-test.yml up --exit-code-from test
- name: Build and push to DockerHub and ECR
uses: docker/build-push-action@v4
with:
context: .
# platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ env.LATEST_TAG }}
${{ steps.login-ecr.outputs.registry }}/dbhive:main-prod
deploy:
needs: build
runs-on: ubuntu-latest
environment: your-github-environment
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Deploy to AWS Elastic BeansTalk
uses: einaregilsson/beanstalk-deploy@v20
with:
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.AWS_ACCESS_KEY_SECRET }}
application_name: dbhive-gha
environment_name: dbhive-gha
version_label: ${{ env.PIPELINE_ID }}
use_existing_version_if_available: true
region: us-west-2
deployment_package: Dockerrun.aws.json