-
Notifications
You must be signed in to change notification settings - Fork 53
146 lines (142 loc) · 5.51 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
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: publish
on:
push:
tags:
- "v*"
branches:
- ccip-develop
- deployment-test
jobs:
build-and-publish:
# Do not trigger from versioned tags.
if: ${{ ! startsWith(github.ref, 'refs/tags/v') }}
environment: publish
permissions:
id-token: write
contents: read
runs-on: ubuntu-latest
steps:
- name: Collect Metrics
id: collect-gha-metrics
uses: smartcontractkit/push-gha-metrics-action@8163dcea2f01a0a8fec84b284406ff7af1d2e1c0
with:
basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }}
hostname: ${{ secrets.GRAFANA_CLOUD_HOST }}
this-job-name: build-and-publish
continue-on-error: true
- name: Checkout the repo
uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3.4.0
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@94ab11c41e45d028884a99163086648e898eed25 # v1.6.0
with:
version: latest
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@67fbcbb121271f7775d2e7715933280b06314838 # v1.7.0
with:
role-to-assume: ${{ secrets.AWS_OIDC_IAM_ROLE_PROD_PUBLISH_ARN }}
role-duration-seconds: ${{ secrets.AWS_ROLE_DURATION_SECONDS }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Login to ECR
uses: docker/login-action@42d299face0c5c43a0487c477f595ac9cf22f1a7 # v1.12.0
with:
registry: ${{ secrets.AWS_ECR_REPO_URL }}
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@507c2f2dc502c992ad446e3d7a5dfbe311567a96 # v4.3.0
with:
images: ${{ secrets.AWS_ECR_REPO_URL }} # list of Docker images to use as base name for tags
tags: |
type=sha,enable={{is_default_branch}}
type=sha,format=long,enable={{is_default_branch}}
- name: Fetch operator-ui
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: make operator-ui
- name: Build and push
id: docker_build
uses: docker/build-push-action@c56af957549030174b10d6867f20e78cfd7debc5 # v3.2.0
with:
context: .
push: true
file: ./core/chainlink.Dockerfile
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
build-args: |
CHAINLINK_USER=chainlink
build-and-publish-release:
# Trigger only from versioned tags.
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
environment: publish
env:
# Public ECR is only available in us-east-1; not a secret.
AWS_REGION: us-east-1
AWS_ECR_REPO_PUBLIC_REGISTRY: public.ecr.aws
permissions:
id-token: write
contents: read
runs-on: ubuntu-latest
steps:
- name: Collect Metrics
id: collect-gha-metrics
uses: smartcontractkit/push-gha-metrics-action@8163dcea2f01a0a8fec84b284406ff7af1d2e1c0
with:
basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }}
hostname: ${{ secrets.GRAFANA_CLOUD_HOST }}
this-job-name: build-and-publish-release
continue-on-error: true
- name: Checkout the repo
uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3.4.0
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@94ab11c41e45d028884a99163086648e898eed25 # v1.6.0
with:
version: latest
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@67fbcbb121271f7775d2e7715933280b06314838 # v1.7.0
with:
role-to-assume: ${{ secrets.AWS_OIDC_IAM_ROLE_PROD_PUBLISH_ARN }}
role-duration-seconds: ${{ secrets.AWS_ROLE_DURATION_SECONDS }}
aws-region: ${{ env.AWS_REGION }}
- name: Login to ECR
uses: docker/login-action@42d299face0c5c43a0487c477f595ac9cf22f1a7 # v1.12.0
with:
registry: ${{ env.AWS_ECR_REPO_PUBLIC_REGISTRY }}
# We use the core SemVer version and then append the the CCIP version in
# a git tag like: v2.5.0-ccip1.1.1
# We also remove the leading "v" prefix from the tag and convert any "+"
# to "-".
- name: Generate Docker image version tag
id: generate-docker-image-tag
shell: bash
run: |
# The "#v" removes the "v" prefix from the ref name
GITHUB_REF_NAME="${GITHUB_REF_NAME#v}"
# Replace any "+" with "-" to make it a valid Docker tag
GITHUB_REF_NAME="${GITHUB_REF_NAME//+/-}"
OUTPUT="type=raw,value=${GITHUB_REF_NAME},enable=true"
echo "tag=${OUTPUT}" | tee -a "${GITHUB_OUTPUT}"
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@507c2f2dc502c992ad446e3d7a5dfbe311567a96 # v4.3.0
with:
images: ${{ env.AWS_ECR_REPO_PUBLIC_REGISTRY }}/w0i8p0z9/chainlink-ccip
tags: |
${{ steps.generate-docker-image-tag.outputs.tag }}
- name: Fetch operator-ui
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: make operator-ui
- name: Build and push
id: docker_build
uses: docker/build-push-action@c56af957549030174b10d6867f20e78cfd7debc5 # v3.2.0
with:
context: .
push: true
file: ./core/chainlink.Dockerfile
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
build-args: |
CHAINLINK_USER=chainlink