Repository navigation
61 lines (58 loc) · 1.78 KB
/
Copy pathcli-go-mirror-image.yml
File metadata and controls
61 lines (58 loc) · 1.78 KB
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
name: Mirror Image
on:
repository_dispatch:
types:
- mirror-image
workflow_call:
inputs:
image:
required: true
type: string
secrets:
PROD_AWS_ROLE:
required: true
workflow_dispatch:
inputs:
image:
description: "org/image:tag"
required: true
type: string
permissions: {}
jobs:
mirror:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- id: strip
env:
TAG: ${{ github.event.client_payload.image || inputs.image }}
run: |
echo "image=${TAG##*/}" >> "$GITHUB_OUTPUT"
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@cbe3b392738ccf3f987d68400dafcf4b0624a56c # v6.2.4
with:
role-to-assume: ${{ secrets.PROD_AWS_ROLE }}
aws-region: us-east-1
- uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: public.ecr.aws
- uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4.3.0
- name: Mirror image
env:
SOURCE_IMAGE: docker.io/${{ github.event.client_payload.image || inputs.image }}
ECR_IMAGE: public.ecr.aws/supabase/${{ steps.strip.outputs.image }}
GHCR_IMAGE: ghcr.io/supabase/${{ steps.strip.outputs.image }}
run: |
docker buildx imagetools create \
--prefer-index=false \
-t "$ECR_IMAGE" \
-t "$GHCR_IMAGE" \
"$SOURCE_IMAGE"