-
Notifications
You must be signed in to change notification settings - Fork 1
68 lines (58 loc) · 2.05 KB
/
publish.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
name: Publish
on:
push:
branches:
- develop
tags:
- "v*"
# Cancel any in-progress CI runs for a PR if it is updated
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build-image:
runs-on: ubuntu-latest
environment: publish
permissions:
id-token: write
contents: write
actions: read
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Configure aws creds
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
role-to-assume: ${{ secrets.AWS_OIDC_IAM_ROLE_ARN }}
role-duration-seconds: 900
aws-region: ${{ secrets.AWS_REGION }}
- name: Login to aws ecr
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2.0.1
with:
registries: ${{ secrets.AWS_ACCOUNT_NUMBER }}
- uses: smartcontractkit/tool-versions-to-env-action@v1.0.8
id: tool-versions
- name: Setup go ${{ steps.tool-versions.outputs.golang_version }}
uses: actions/setup-go@v4
with:
go-version: ${{ steps.tool-versions.outputs.golang_version }}
- name: Setup docker buildx
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ secrets.AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/timelock-worker
tags: |
type=ref,event=branch
type=ref,event=pr
type=sha,enable=true,priority=100,prefix=sha-,suffix=,format=short
type=semver,pattern={{version}}
- name: Docker build and push
uses: docker/build-push-action@v5
with:
context: .
file: builds/Dockerfile
push: true
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}