forked from permaweb/ao
-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (118 loc) Β· 5.09 KB
/
devnet-ecr-push.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
name: ποΈ Build and Push Docker images to devnet ECR
on:
push:
branches:
- 'main'
paths:
- "servers/**"
- ".github/workflows/devnet-ecr-push.yml"
jobs:
build-and-push-cu:
runs-on: ubuntu-latest
env:
REPOSITORY: devnet-ecr
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Extract shortened commit hash
id: vars
run: echo "COMMIT_HASH=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV
- name: Log in to Amazon ECR
id: login-devnet-ecr
uses: aws-actions/amazon-ecr-login@v1
with:
mask-password: true
skip-logout: true
registry-type: private
registries: ${{ secrets.AWS_ACCOUNT_ID_AO_DEVNET }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_AO_DEVNET }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_AO_DEVNET }}
AWS_REGION: ${{ secrets.AWS_REGION_AO_DEVNET }}
- name: Build and push CU Docker image
run: |
docker build -t ${{ secrets.AWS_ACCOUNT_ID_AO_DEVNET }}.dkr.ecr.${{ secrets.AWS_REGION_AO_DEVNET }}.amazonaws.com/$REPOSITORY:ao-cu-$COMMIT_HASH -f servers/cu/Dockerfile servers/cu/
docker push ${{ secrets.AWS_ACCOUNT_ID_AO_DEVNET }}.dkr.ecr.${{ secrets.AWS_REGION_AO_DEVNET }}.amazonaws.com/$REPOSITORY:ao-cu-$COMMIT_HASH
build-and-push-mu:
env:
REPOSITORY: devnet-ecr
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Extract shortened commit hash
id: vars
run: echo "COMMIT_HASH=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV
- name: Log in to Amazon ECR
id: login-devnet-ecr
uses: aws-actions/amazon-ecr-login@v1
with:
mask-password: true
skip-logout: true
registry-type: private
registries: ${{ secrets.AWS_ACCOUNT_ID_AO_DEVNET }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_AO_DEVNET }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_AO_DEVNET }}
AWS_REGION: ${{ secrets.AWS_REGION_AO_DEVNET }}
- name: Build and push MU Docker image
run: |
docker build -t ${{ secrets.AWS_ACCOUNT_ID_AO_DEVNET }}.dkr.ecr.${{ secrets.AWS_REGION_AO_DEVNET }}.amazonaws.com/$REPOSITORY:ao-mu-$COMMIT_HASH -f servers/mu/Dockerfile servers/mu/
docker push ${{ secrets.AWS_ACCOUNT_ID_AO_DEVNET }}.dkr.ecr.${{ secrets.AWS_REGION_AO_DEVNET }}.amazonaws.com/$REPOSITORY:ao-mu-$COMMIT_HASH
build-and-push-su:
env:
REPOSITORY: devnet-ecr
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Extract shortened commit hash
id: vars
run: echo "COMMIT_HASH=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV
- name: Log in to Amazon ECR
id: login-devnet-ecr
uses: aws-actions/amazon-ecr-login@v1
with:
mask-password: true
skip-logout: true
registry-type: private
registries: ${{ secrets.AWS_ACCOUNT_ID_AO_DEVNET }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_AO_DEVNET }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_AO_DEVNET }}
AWS_REGION: ${{ secrets.AWS_REGION_AO_DEVNET }}
- name: Build and push SU Docker image
run: |
docker build -t ${{ secrets.AWS_ACCOUNT_ID_AO_DEVNET }}.dkr.ecr.${{ secrets.AWS_REGION_AO_DEVNET }}.amazonaws.com/$REPOSITORY:ao-su-$COMMIT_HASH -f servers/su/Dockerfile.x86 servers/su/
docker push ${{ secrets.AWS_ACCOUNT_ID_AO_DEVNET }}.dkr.ecr.${{ secrets.AWS_REGION_AO_DEVNET }}.amazonaws.com/$REPOSITORY:ao-su-$COMMIT_HASH
update-devnet-image-tags:
runs-on: ubuntu-latest
needs:
- build-and-push-cu
- build-and-push-mu
- build-and-push-su
steps:
- name: Checkout Helmfile Repository
run: |
git clone https://$GITHUB_USERNAME:${{ secrets.AO_TO_CHARTS_PAT }}@github.com/permaweb/charts.git
env:
GITHUB_USERNAME: bredamatt
- name: Extract shortened commit hash
id: vars
run: echo "COMMIT_HASH=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV
- name: Update commit-sha.yaml
env:
TRUNCATED_SHA: ${{ env.COMMIT_HASH }}
run: |
cd charts
sed -i "s/commitSHA: \".*\"/commitSHA: \"${TRUNCATED_SHA}\"/" helmfile/devnet/commit-sha.yaml
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git commit -am "fix: from ao-repo - update commit-sha to ${TRUNCATED_SHA} for syncing latest image tags"
git push https://${{ secrets.AO_TO_CHARTS_PAT }}@github.com/permaweb/charts.git main