-
Notifications
You must be signed in to change notification settings - Fork 81
50 lines (47 loc) · 1.38 KB
/
on-push-to-main-branch.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
name: On Push to Main Branch
on:
push:
branches: [ main ]
env:
ECR_REPO: public.ecr.aws/z0d6s8x8
jobs:
build:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Check out code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Dockerx
uses: docker/setup-buildx-action@v1
- name: Setup AWS Credentials
uses: aws-actions/configure-aws-credentials@master
with:
role-to-assume: arn:aws:iam::783680406432:role/GithubActionsPublishRole-test-us-east-1
aws-region: us-east-1
- name: Login to Public ECR
uses: docker/login-action@v1
with:
registry: public.ecr.aws
env:
AWS_REGION: us-east-1
- name: Setup Push to ECR
run: |
export PLUGIN_VERSION=$(git describe --tags)
export TAG_BASE=${{ env.ECR_REPO }}/$(echo $GITHUB_REPOSITORY | sed s#/#-#)-test
echo TAG_BASE=$TAG_BASE >> $GITHUB_ENV
echo PLUGIN_VERSION=$PLUGIN_VERSION >> $GITHUB_ENV
- name: Build and push container images
uses: docker/build-push-action@v2
with:
build-args: |
pkg_version=${{ env.PLUGIN_VERSION }}
context: .
platforms: linux/amd64,linux/arm64
tags: |
${{ env.TAG_BASE }}:latest
${{ env.TAG_BASE }}:${{ env.PLUGIN_VERSION }}
push: true