Skip to content

Commit 0774be6

Browse files
committed
chore: add Aliyun credentials configuration and enhance Docker login steps in GitHub Actions workflow
1 parent a0f10d5 commit 0774be6

File tree

1 file changed

+29
-16
lines changed

1 file changed

+29
-16
lines changed

.github/workflows/build.yaml

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,36 @@ jobs:
3838
with:
3939
platforms: all
4040

41+
- uses: aliyun/configure-aliyun-credentials-action@v1
42+
id: aliyun-auth
43+
with:
44+
role-to-assume: "acs:ram::5621254376179407:role/docker"
45+
oidc-provider-arn: "acs:ram::5621254376179407:oidc-provider/github"
46+
role-session-name: "github-action-session"
47+
role-session-expiration: 1800
48+
audience: "sts.aliyuncs.com"
49+
4150
- name: Login to DockerHub
4251
uses: docker/login-action@v2
4352
with:
4453
username: ${{ secrets.DOCKERHUB_USERNAME }}
4554
password: ${{ secrets.DOCKERHUB_TOKEN }}
4655

56+
- name: Login to ghcr
57+
uses: docker/login-action@v2
58+
with:
59+
registry: ghcr.io
60+
username: ${{ github.actor }}
61+
password: ${{ github.token }}
62+
63+
- name: Login to ACR
64+
id: login-acr
65+
uses: aliyun/acr-login@v2.0.1
66+
with:
67+
login-server: https://container-registry.us-east-1.cr.aliyuncs.com
68+
region-id: "us-east-1"
69+
instance-id: cri-0jrfa7tkgiwjzabf
70+
4771
- name: Build and push
4872
uses: docker/bake-action@v5
4973
with:
@@ -65,21 +89,12 @@ jobs:
6589
max-parallel: 3
6690
matrix:
6791
target: ${{ fromJson(needs.prepare.outputs.targets) }}
68-
registry:
69-
- docker.io
70-
- ghcr.io
71-
- container-registry.us-east-1.cr.aliyuncs.com
72-
repository:
73-
- rss3
74-
- ${{ github.repository }}
75-
# ghcr.io with github.repository
76-
# docker.io and aliyun with rss3
77-
exclude:
78-
- registry: docker.io
92+
include:
93+
- registry: ghcr.io
7994
repository: ${{ github.repository }}
95+
- registry: docker.io
96+
repository: rss3
8097
- registry: container-registry.us-east-1.cr.aliyuncs.com
81-
repository: ${{ github.repository }}
82-
- registry: ghcr.io
8398
repository: rss3
8499

85100
steps:
@@ -117,10 +132,8 @@ jobs:
117132
id: login-acr
118133
uses: aliyun/acr-login@v2.0.1
119134
with:
135+
login-server: https://container-registry.us-east-1.cr.aliyuncs.com
120136
region-id: "us-east-1"
121-
access-key-id: ${{ steps.aliyun-auth.outputs.aliyun-access-key-id }}
122-
access-key-secret: ${{ steps.aliyun-auth.outputs.aliyun-access-key-secret }}
123-
security-token: ${{ steps.aliyun-auth.outputs.aliyun-security-token }}
124137
instance-id: cri-0jrfa7tkgiwjzabf
125138

126139
- name: Build and push

0 commit comments

Comments
 (0)