forked from datafuselabs/databend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
56 lines (51 loc) 路 1.56 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
name: "Setup Docker Registries"
description: "Setup Docker Registries"
inputs:
dockerhub_user:
description: "DockerHub User"
required: true
dockerhub_token:
description: "DockerHub Token"
required: true
ecr_role_arn:
description: "ECR Role ARN"
required: true
repo:
description: "Docker Repo to push"
required: true
outputs:
dockerhub_repo:
description: "DockerHub Repository"
value: ${{ steps.registry.outputs.dockerhub }}
ecr_repo:
description: "AWS public ECR Repository"
value: ${{ steps.registry.outputs.ecr }}
runs:
using: "composite"
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Configure AWS Credentials
if: inputs.ecr_role_arn
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ inputs.ecr_role_arn }}
role-duration-seconds: 900
aws-region: us-east-2
- name: Login to Public ECR
if: inputs.ecr_role_arn
shell: bash
run: |
docker login --username AWS --password $(aws ecr-public get-login-password --region us-east-1) public.ecr.aws
- name: Login to DockerHub
if: inputs.dockerhub_token
uses: docker/login-action@v2
with:
username: ${{ inputs.dockerhub_user }}
password: ${{ inputs.dockerhub_token }}
- name: Output Registries
shell: bash
id: registry
run: |
echo 'dockerhub=datafuselabs/${{ inputs.repo }}' >> $GITHUB_OUTPUT
echo 'ecr=public.ecr.aws/i7g1w5q7/${{ inputs.repo }}' >> $GITHUB_OUTPUT