-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (62 loc) · 1.95 KB
/
push-to-registry.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
name: Push to ECR Registry
on:
workflow_dispatch:
inputs:
tag:
type: string
description: Tag to use for image. Defaults to $GITHUB_REF
required: False
workflow_call:
inputs:
tag:
type: string
description: Tag to use for image. Defaults to $GITHUB_REF
required: False
jobs:
build-and-push:
runs-on: ubuntu-latest
env:
INPUT_PATH: "."
steps:
- uses: actions/checkout@v3
- name: Get repo name
id: repoName
run: |
prefix=nanome-ai/plugin-
git_repository="${{github.repository}}"
repo_name=${git_repository/#$prefix}
echo $repo_name
echo "repo_name=$repo_name" >> $GITHUB_OUTPUT
- name: Set default tag
id: default_tag
run: |
default_tag="${GITHUB_REF#refs/*/}"
echo Default tag = $default_tag
echo "name=default_tag" >> $GITHUB_OUTPUT
- name: Get short SHA
id: sha7
run: echo "sha7=$(echo ${GITHUB_SHA} | cut -c1-7)" >> $GITHUB_OUTPUT
- name: Get tag
id: tag
run: |
input_tag=${{ inputs.tag }}
echo $input_tag
echo "tag=$input_tag" >> $GITHUB_OUTPUT
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1-node16
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build and Push to ECR public
id: build-and-push
uses: nanome-ai/ecr-public-action@8a5a154857f64bb4ac345eb1bc57661603b91ba9
with:
dockerfile: docker/Dockerfile
context: .
tags: |
public.ecr.aws/h7r1e4h2/${{ steps.repoName.outputs.repo_name }}:${{ steps.tag.outputs.tag }}
public.ecr.aws/h7r1e4h2/${{ steps.repoName.outputs.repo_name }}:${{ steps.sha7.outputs.sha7 }}