-
Notifications
You must be signed in to change notification settings - Fork 1
72 lines (62 loc) · 2.08 KB
/
build-and-push.yaml
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
name: Build and push ink-dev container to ECR
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
on:
workflow_dispatch:
push:
branches:
- main
paths-ignore:
- '*.md'
- 'LICENSE'
pull_request:
jobs:
build-test-docker:
name: Build docker image and test on contract
runs-on: ubuntu-20.04
if: github.event_name == 'pull_request'
steps:
- name: GIT | Checkout Source code
uses: actions/checkout@v2
- name: DOCKER | Build image and run test
run: make build-ink-dev-x86_64 && make test-contract-x86_64
build-push-docker:
name: Build and push
runs-on: ubuntu-20.04
if: >
github.ref == 'refs/heads/main' && github.event_name != 'pull_request' ||
github.event_name == 'workflow_dispatch'
steps:
- name: GIT | Checkout Source code
uses: actions/checkout@v2
- name: AWS | Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_MAINNET_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_MAINNET_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: AWS | Login to ECR
uses: docker/login-action@v1
with:
registry: public.ecr.aws
username: ${{ secrets.AWS_MAINNET_ACCESS_KEY_ID }}
password: ${{ secrets.AWS_MAINNET_SECRET_ACCESS_KEY }}
- name: DOCKER | Export IMAGE_TAG
run: |
echo "IMAGE_TAG=`cat Makefile | grep "DOCKER_TAG :=" | awk '{print $3}'`" >> $GITHUB_ENV
- name: DOCKER | Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
version: v0.9.1
- name: DOCKER | Build and push docker image
uses: docker/build-push-action@v3
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
file: ./Dockerfile
push: true
tags: |
public.ecr.aws/p6e8q1z1/ink-dev:${{ env.IMAGE_TAG }}
public.ecr.aws/p6e8q1z1/ink-dev:latest