Skip to content

Commit eb2d257

Browse files
authored
Add Alibaba Cloud container image push functionality to CI workflow (#2059)
* add aliyun image push * update readme
1 parent 1c69c5c commit eb2d257

File tree

7 files changed

+431
-32
lines changed

7 files changed

+431
-32
lines changed

.github/workflows/dockerize-runtime-nodejs.yml

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ on:
1818
- "!**/*.md"
1919
- "!runtimes/nodejs/package-lock.json"
2020

21+
env:
22+
ALIYUN_REGISTRY: ${{ secrets.ALIYUN_REGISTRY }}
23+
ALIYUN_NAMESPACE: ${{ secrets.ALIYUN_NAMESPACE }}
24+
2125
permissions:
2226
pull-requests: write
2327
packages: write
@@ -60,11 +64,12 @@ jobs:
6064
- name: Docker meta (for push events only)
6165
id: meta
6266
if: github.event_name != 'pull_request'
63-
uses: docker/metadata-action@v4
67+
uses: docker/metadata-action@v5
6468
with:
6569
images: |
6670
ghcr.io/${{ github.repository_owner }}/laf-runtime-nodejs
6771
docker.io/${{ secrets.DOCKER_USERNAME }}/laf-runtime-nodejs
72+
${{ env.ALIYUN_REGISTRY && format('{0}/{1}/laf-runtime-nodejs', env.ALIYUN_REGISTRY, env.ALIYUN_NAMESPACE) || '' }}
6873
# https://github.com/docker/metadata-action#typesemver
6974
tags: |
7075
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
@@ -79,19 +84,27 @@ jobs:
7984

8085
- name: Login to DockerHub
8186
if: github.event_name != 'pull_request'
82-
uses: docker/login-action@v2
87+
uses: docker/login-action@v3
8388
with:
8489
username: ${{ secrets.DOCKER_USERNAME }}
8590
password: ${{ secrets.DOCKER_PASSWORD }}
8691

8792
- name: Login to Github Container Hub
8893
if: github.event_name != 'pull_request'
89-
uses: docker/login-action@v2
94+
uses: docker/login-action@v3
9095
with:
9196
registry: ghcr.io
9297
username: ${{ github.repository_owner }}
9398
password: ${{ secrets.GITHUB_TOKEN }}
9499

100+
- name: Login to Aliyun Registry
101+
uses: docker/login-action@v3
102+
if: ${{ github.event_name != 'pull_request' && env.ALIYUN_REGISTRY }}
103+
with:
104+
registry: ${{ env.ALIYUN_REGISTRY }}
105+
username: ${{ secrets.ALIYUN_USERNAME }}
106+
password: ${{ secrets.ALIYUN_PASSWORD }}
107+
95108
- name: Build and push
96109
id: docker-build
97110
uses: docker/build-push-action@v3
@@ -121,11 +134,12 @@ jobs:
121134
- name: Docker meta (for push events only)
122135
id: meta
123136
if: github.event_name != 'pull_request'
124-
uses: docker/metadata-action@v4
137+
uses: docker/metadata-action@v5
125138
with:
126139
images: |
127140
ghcr.io/${{ github.repository_owner }}/laf-runtime-nodejs-init
128141
docker.io/${{ secrets.DOCKER_USERNAME }}/laf-runtime-nodejs-init
142+
${{ env.ALIYUN_REGISTRY && format('{0}/{1}/laf-runtime-nodejs-init', env.ALIYUN_REGISTRY, env.ALIYUN_NAMESPACE) || '' }}
129143
# https://github.com/docker/metadata-action#typesemver
130144
tags: |
131145
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
@@ -140,19 +154,27 @@ jobs:
140154

141155
- name: Login to DockerHub
142156
if: github.event_name != 'pull_request'
143-
uses: docker/login-action@v2
157+
uses: docker/login-action@v3
144158
with:
145159
username: ${{ secrets.DOCKER_USERNAME }}
146160
password: ${{ secrets.DOCKER_PASSWORD }}
147161

148162
- name: Login to Github Container Hub
149163
if: github.event_name != 'pull_request'
150-
uses: docker/login-action@v2
164+
uses: docker/login-action@v3
151165
with:
152166
registry: ghcr.io
153167
username: ${{ github.repository_owner }}
154168
password: ${{ secrets.GITHUB_TOKEN }}
155169

170+
- name: Login to Aliyun Registry
171+
uses: docker/login-action@v3
172+
if: ${{ github.event_name != 'pull_request' && env.ALIYUN_REGISTRY }}
173+
with:
174+
registry: ${{ env.ALIYUN_REGISTRY }}
175+
username: ${{ secrets.ALIYUN_USERNAME }}
176+
password: ${{ secrets.ALIYUN_PASSWORD }}
177+
156178
- name: Build and push
157179
id: docker-build
158180
uses: docker/build-push-action@v3

0 commit comments

Comments
 (0)