/
action.yml
129 lines (128 loc) · 4.19 KB
/
action.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Build Image For Testing
description: Common docker image builder for building chainlink test images
inputs:
cl_repo:
required: true
description: The chainlink repository to use
default: ${{ github.repository }}
cl_ref:
required: false
description: The git ref from the chainlink repository to use
default: develop
push_tag:
required: true
description: The full docker tag to use for the push to ecr, does not push anything if tag is empty
dep_solana_sha:
required: false
description: chainlink-solana commit or branch
dep_terra_sha:
required: false
description: chainlink-terra commit or branch
dep_starknet_sha:
required: false
description: chainlink-starknet commit or branch
dep_atlas_sha:
required: false
description: atlas commit or branch
dep_relay_sha:
required: false
description: chainlink-relay commit or branch
QA_AWS_REGION:
required: true
description: The AWS region to use
QA_AWS_ROLE_TO_ASSUME:
required: true
description: The AWS role to assume
QA_PRIVATE_GHA_PULL:
required: false
description: Token to pull private repos
GOPRIVATE:
required: false
description: private repos needed for go
runs:
using: composite
steps:
- name: Checkout Chainlink repo
uses: actions/checkout@v3
with:
repository: ${{ inputs.cl_repo }}
ref: ${{ inputs.cl_ref }}
- uses: actions/setup-go@v3
env:
GOPRIVATE: ${{ inputs.GOPRIVATE }}
with:
go-version-file: "go.mod"
check-latest: true
- name: Replace GHA URL
shell: bash
env:
GOPRIVATE: ${{ inputs.GOPRIVATE }}
QA_PRIVATE_GHA_PULL: ${{ inputs.QA_PRIVATE_GHA_PULL }}
run: git config --global url.https://${{ inputs.QA_PRIVATE_GHA_PULL }}@github.com/.insteadOf https://github.com/
- name: Replace Solana deps
if: ${{ inputs.dep_solana_sha }}
shell: bash
run: go get github.com/smartcontractkit/chainlink-solana@${{ inputs.dep_solana_sha }}
- name: Replace Terra deps
if: ${{ inputs.dep_terra_sha }}
shell: bash
run: go get github.com/smartcontractkit/chainlink-terra@${{ inputs.dep_terra_sha }}
- name: Replace StarkNet deps
if: ${{ inputs.dep_starknet_sha }}
shell: bash
run: go get github.com/smartcontractkit/chainlink-starknet/relayer@${{ inputs.dep_starknet_sha }}
- name: Replace Atlas deps
if: ${{ inputs.dep_atlas_sha }}
shell: bash
env:
GOPRIVATE: ${{ inputs.GOPRIVATE }}
run: go get github.com/smartcontractkit/atlas@${{ inputs.dep_atlas_sha }}
- name: Replace chainlink-relay deps
if: ${{ inputs.dep_relay_sha }}
shell: bash
run: go get github.com/smartcontractkit/chainlink-relay@${{ inputs.dep_relay_sha }}
- name: Tidy
shell: bash
env:
GOPRIVATE: ${{ inputs.GOPRIVATE }}
run: go mod tidy
- name: Env vars
shell: bash
run: env
- name: Cat go.mod
shell: bash
run: cat go.mod
- name: Setup push_tag
id: push
shell: bash
run: |
if [ "${{ inputs.push_tag }}" != "" ]; then
# tag exists so we can push
echo "push=true" >>$GITHUB_OUTPUT
else
# tag is empty, don't push
echo "push=false" >>$GITHUB_OUTPUT
fi
- name: Configure AWS Credentials
if: steps.push.outputs.push == 'true'
uses: aws-actions/configure-aws-credentials@495fc37803e35461021a6229a7c1a9cda25e54fe
with:
aws-region: ${{ inputs.QA_AWS_REGION }}
role-to-assume: ${{ inputs.QA_AWS_ROLE_TO_ASSUME }}
role-duration-seconds: 3600
- name: Login to Amazon ECR
if: steps.push.outputs.push == 'true'
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Set up Docker Buildx
if: steps.push.outputs.push == 'true'
uses: docker/setup-buildx-action@v2
- name: Build and Push
uses: docker/build-push-action@v3
with:
context: .
file: core/chainlink.Dockerfile
# comma separated like: KEY1=VAL1,KEY2=VAL2,...
build-args: COMMIT_SHA=${{ github.sha }}
tags: ${{ inputs.push_tag }}
push: ${{ steps.push.outputs.push }}