Skip to content

Commit 82380e6

Browse files
committed
Update docker-image.yml
1 parent 01705de commit 82380e6

File tree

1 file changed

+45
-45
lines changed

1 file changed

+45
-45
lines changed

.github/workflows/docker-image.yml

+45-45
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
default: ''
1010

1111
env:
12-
ALIYUN_REGISTRY: "registry.cn-hangzhou.aliyuncs.com"
12+
ALIYUN_REGISTRY: "${{ secrets.DOCKER_REGISTRY_ALIYUN }}"
1313
ALIYUN_REGISTRY_USER: "${{ secrets.DOCKER_USERNAME_ALIYUN }}"
1414
ALIYUN_REGISTRY_PASSWORD: "${{ secrets.DOCKER_PASSWORD_ALIYUN }}"
1515

@@ -18,53 +18,53 @@ jobs:
1818
name: Push Docker image to Docker Hub
1919
runs-on: ubuntu-latest
2020
permissions:
21-
packages: write
22-
contents: read
23-
attestations: write
24-
id-token: write
21+
packages: write
22+
contents: read
23+
attestations: write
24+
id-token: write
2525
steps:
26-
- name: Check out the repo
27-
uses: actions/checkout@v4
26+
- name: Check out the repo
27+
uses: actions/checkout@v4
2828

29-
- name: Log in to Docker Hub
30-
uses: docker/login-action@v2
31-
with:
32-
username: ${{ secrets.DOCKER_USERNAME }}
33-
password: ${{ secrets.DOCKER_PASSWORD }}
29+
- name: Log in to Docker Hub
30+
uses: docker/login-action@v2
31+
with:
32+
username: ${{ secrets.DOCKER_USERNAME }}
33+
password: ${{ secrets.DOCKER_PASSWORD }}
3434

35-
- name: Extract metadata (tags, labels) for Docker
36-
id: meta
37-
uses: docker/metadata-action@v4
38-
with:
39-
images: answerhuang/fabulove
35+
- name: Extract metadata (tags, labels) for Docker
36+
id: meta
37+
uses: docker/metadata-action@v4
38+
with:
39+
images: answerhuang/fabulove
4040

41-
- name: Set current timestamp
42-
id: timestamp
43-
run: echo "TIMESTAMP=$(date +%s)" >> $GITHUB_ENV
41+
- name: Set current timestamp
42+
id: timestamp
43+
run: echo "TIMESTAMP=$(date +%s)" >> $GITHUB_ENV
4444

45-
- name: Set default image tag if not provided
46-
if: ${{ github.event.inputs.image_tag == '' }}
47-
run: echo "IMAGE_TAG=${{ env.TIMESTAMP }}" >> $GITHUB_ENV
45+
- name: Set default image tag if not provided
46+
if: ${{ github.event.inputs.image_tag == '' }}
47+
run: echo "IMAGE_TAG=${{ env.TIMESTAMP }}" >> $GITHUB_ENV
4848

49-
- name: Build and push Docker image
50-
id: push
51-
uses: docker/build-push-action@v3
52-
with:
53-
context: .
54-
file: ./docker/Dockerfile
55-
push: true
56-
tags: answerhuang/fabulove:${{ github.event.inputs.image_tag }}
57-
labels: ${{ steps.meta.outputs.labels }}
58-
- name: Rename
59-
id: rename
60-
run: docker tag answerhuang/fabulove:${{ github.event.inputs.image_tag }} $ALIYUN_REGISTRY/great_free/fabulove:${{ github.event.inputs.image_tag }}
61-
- name: Login Aliyun
62-
id: login
63-
run: |
64-
echo $ALIYUN_REGISTRY_USER
65-
echo $ALIYUN_REGISTRY_PASSWORD
66-
echo $ALIYUN_REGISTRY
67-
docker login -u $ALIYUN_REGISTRY_USER -p $ALIYUN_REGISTRY_PASSWORD $ALIYUN_REGISTRY
68-
- name: Push to Aliyun
69-
id: push_aliyun
70-
run: docker push registry.cn-hangzhou.aliyuncs.com/great_free/fabulove:${{ github.event.inputs.image_tag }}
49+
- name: Build and push Docker image
50+
id: push
51+
uses: docker/build-push-action@v3
52+
with:
53+
context: .
54+
file: ./docker/Dockerfile
55+
push: true
56+
tags: answerhuang/fabulove:${{ github.event.inputs.image_tag }}
57+
labels: ${{ steps.meta.outputs.labels }}
58+
- name: Rename
59+
id: rename
60+
run: docker tag answerhuang/fabulove:${{ github.event.inputs.image_tag }} $ALIYUN_REGISTRY/great_free/fabulove:${{ github.event.inputs.image_tag }}
61+
- name: Login Aliyun
62+
id: login
63+
run: |
64+
echo $ALIYUN_REGISTRY_USER
65+
echo $ALIYUN_REGISTRY_PASSWORD
66+
echo $ALIYUN_REGISTRY
67+
docker login -u $ALIYUN_REGISTRY_USER -p $ALIYUN_REGISTRY_PASSWORD $ALIYUN_REGISTRY
68+
- name: Push to Aliyun
69+
id: push_aliyun
70+
run: docker push registry.cn-hangzhou.aliyuncs.com/great_free/fabulove:${{ github.event.inputs.image_tag }}

0 commit comments

Comments
 (0)