-
-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (39 loc) · 1.11 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
name: Deploy
on:
push:
branches: [ main ]
tags:
- v*
env:
IMAGE_NAME: 'apj-demo-1'
PROJECT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
jobs:
build-push-docker:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-session-name: ${{ secrets.AWS_ROLE_SESSION_NAME }}
aws-region: ap-southeast-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
with:
registries: ${{ secrets.AWS_ACCOUNT_ID }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.ECR_REGISTRY }}/${{ env.IMAGE_NAME }}
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
- name: Build and push Docker images
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}