-
Notifications
You must be signed in to change notification settings - Fork 808
77 lines (65 loc) · 2.35 KB
/
publish-ecr.yaml
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
name: Publish to ECR
on:
push:
tags: ['*']
jobs:
ecr-private:
name: Push to ECR Private
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- 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 }}
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-session-name: GitHubCI
aws-region: us-east-1
role-duration-seconds: 1800
role-skip-session-tagging: true
- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v1
- name: Set environment variables
env:
REGISTRY: ${{ secrets.ECR_PRIVATE_REPOSITORY }}
run: |
echo "REGISTRY=${REGISTRY}" >> $GITHUB_ENV
echo "TAG=${GITHUB_REF_NAME}" >> $GITHUB_ENV
echo "VERSION=${GITHUB_REF_NAME}" >> $GITHUB_ENV
- name: Build, tag, and push manifest to Amazon ECR
run: make -j `nproc` all-push
ecr-public:
name: Push to ECR Public
runs-on: ubuntu-latest
environment: ecr-public
needs: ecr-private
steps:
- name: Set up crane
uses: imjasonh/[email protected]
- 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 }}
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-session-name: GitHubCI
aws-region: us-east-1
role-duration-seconds: 1800
role-skip-session-tagging: true
- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v1
- name: Login to Amazon ECR Public
uses: aws-actions/amazon-ecr-login@v1
with:
registry-type: public
- name: Copy manifest to ECR Public
env:
ECR_PRIVATE_REPOSITORY: ${{ secrets.ECR_PRIVATE_REPOSITORY }}
ECR_PUBLIC_REPOSITORY: ${{ secrets.ECR_PUBLIC_REPOSITORY }}
run: crane copy ${ECR_PRIVATE_REPOSITORY}/aws-ebs-csi-driver:${GITHUB_REF_NAME} ${ECR_PUBLIC_REPOSITORY}/aws-ebs-csi-driver:${GITHUB_REF_NAME}