|
7 | 7 |
|
8 | 8 | env: |
9 | 9 | GIT_COMMIT: ${{ github.sha }} |
| 10 | + ACR_INSTANCE_ID: cri-0jrfa7tkgiwjzabf |
10 | 11 |
|
11 | 12 | permissions: |
12 | 13 | contents: read |
@@ -44,36 +45,12 @@ jobs: |
44 | 45 | with: |
45 | 46 | platforms: all |
46 | 47 |
|
47 | | - - uses: aliyun/configure-aliyun-credentials-action@v1 |
48 | | - id: aliyun-auth |
49 | | - with: |
50 | | - role-to-assume: "acs:ram::5621254376179407:role/docker" |
51 | | - oidc-provider-arn: "acs:ram::5621254376179407:oidc-provider/github" |
52 | | - role-session-name: "github-action-session" |
53 | | - role-session-expiration: 1800 |
54 | | - audience: "sts.aliyuncs.com" |
55 | | - |
56 | 48 | - name: Login to DockerHub |
57 | | - uses: docker/login-action@v2 |
| 49 | + uses: docker/login-action@v3 |
58 | 50 | with: |
59 | 51 | username: ${{ secrets.DOCKERHUB_USERNAME }} |
60 | 52 | password: ${{ secrets.DOCKERHUB_TOKEN }} |
61 | 53 |
|
62 | | - - name: Login to ghcr |
63 | | - uses: docker/login-action@v2 |
64 | | - with: |
65 | | - registry: ghcr.io |
66 | | - username: ${{ github.actor }} |
67 | | - password: ${{ github.token }} |
68 | | - |
69 | | - - name: Login to ACR |
70 | | - id: login-acr |
71 | | - uses: aliyun/acr-login@v2.0.1 |
72 | | - with: |
73 | | - login-server: https://container-registry.us-east-1.cr.aliyuncs.com |
74 | | - region-id: "us-east-1" |
75 | | - instance-id: cri-0jrfa7tkgiwjzabf |
76 | | - |
77 | 54 | - name: Build and push |
78 | 55 | uses: docker/bake-action@v5 |
79 | 56 | with: |
@@ -118,25 +95,39 @@ jobs: |
118 | 95 | audience: "sts.aliyuncs.com" |
119 | 96 |
|
120 | 97 | - name: Login to DockerHub |
121 | | - uses: docker/login-action@v2 |
| 98 | + uses: docker/login-action@v3 |
122 | 99 | with: |
123 | 100 | username: ${{ secrets.DOCKERHUB_USERNAME }} |
124 | 101 | password: ${{ secrets.DOCKERHUB_TOKEN }} |
125 | 102 |
|
126 | 103 | - name: Login to ghcr |
127 | | - uses: docker/login-action@v2 |
| 104 | + uses: docker/login-action@v3 |
128 | 105 | with: |
129 | 106 | registry: ghcr.io |
130 | 107 | username: ${{ github.actor }} |
131 | 108 | password: ${{ github.token }} |
132 | 109 |
|
| 110 | + - name: setup aliyun cli |
| 111 | + uses: aliyun/setup-aliyun-cli-action@v1 |
| 112 | + |
| 113 | + - name: get acr credential |
| 114 | + id: acr-cred |
| 115 | + run: | |
| 116 | + RESPONSE=$(aliyun cr GetAuthorizationToken --region us-east-1 --InstanceId ${{ env.ACR_INSTANCE_ID }}) |
| 117 | + TEMP_USERNAME=$(echo "$RESPONSE" | jq -r '.TempUsername') |
| 118 | + AUTH_TOKEN=$(echo "$RESPONSE" | jq -r '.AuthorizationToken') |
| 119 | +
|
| 120 | + echo "::add-mask::$AUTH_TOKEN" |
| 121 | +
|
| 122 | + echo "username=$TEMP_USERNAME" >> $GITHUB_OUTPUT |
| 123 | + echo "password=$AUTH_TOKEN" >> $GITHUB_OUTPUT |
| 124 | +
|
133 | 125 | - name: Login to ACR |
134 | | - id: login-acr |
135 | | - uses: aliyun/acr-login@v2.0.1 |
| 126 | + uses: docker/login-action@v3 |
136 | 127 | with: |
137 | | - login-server: https://container-registry.us-east-1.cr.aliyuncs.com |
138 | | - region-id: "us-east-1" |
139 | | - instance-id: cri-0jrfa7tkgiwjzabf |
| 128 | + registry: container-registry.us-east-1.cr.aliyuncs.com |
| 129 | + username: ${{ steps.acr-cred.outputs.username }} |
| 130 | + password: ${{ steps.acr-cred.outputs.password }} |
140 | 131 |
|
141 | 132 | - name: Build and push |
142 | 133 | uses: docker/bake-action@v5 |
|
0 commit comments