-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (81 loc) · 2.82 KB
/
docker-publish.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
name: Docker Image Stable Newest CI
on:
push:
branches: [ "main" ]
workflow_dispatch:
jobs:
build-docker-image-latest-main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Check Version Setting
run: |
python --version
pip --version
- name: Set up Program Version
run: |
python version.py
PROGRAM_VERSION=$(python version.py)
echo "PROGRAM_VERSION=${PROGRAM_VERSION}" >> $GITHUB_ENV
- name: Echo Program Version
run: echo "'${{ env.PROGRAM_VERSION }}' will be used as the version of the program."
- name: Build .jar file
run: python build_with_docker.py
- name: Check is Build Success
run: ls group-center-docker.jar
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker BuildX
uses: docker/setup-buildx-action@v3
- name: Set up Aliyun Region
env:
ACR_REGION: cn-shanghai
run: |
echo "ACR_REGION=$ACR_REGION" >> $GITHUB_ENV
echo "ACR_REGISTRY=registry.${ACR_REGION}.aliyuncs.com" >> $GITHUB_ENV
- name: Confirm Aliyun ACR
run: |
echo "Aliyun ACR REGION=$ACR_REGION"
echo "Aliyun ACR REGISTRY=$ACR_REGISTRY"
- name: Login to Aliyun Container Registry (ACR)
uses: docker/login-action@v3
with:
registry: ${{ env.ACR_REGISTRY }}
username: ${{ secrets.ALIYUN_USERNAME }}
password: ${{ secrets.ALIYUN_PASSWORD }}
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Set up Image Tags
env:
GITHUB_SHA: ${{ github.sha }}
IMAGE_TAG: latest
run: |
echo "GITHUB_SHA=$GITHUB_SHA" >> $GITHUB_ENV
echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV
echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV
- name: Build & Push image
id: docker_build
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
platforms:
linux/amd64,
linux/arm64,
push: true
tags: |
${{ github.repository }}:${{ env.IMAGE_TAG }},
${{ github.repository }}:${{ env.PROGRAM_VERSION }},
${{ env.ACR_REGISTRY }}/${{ github.repository }}:${{ env.IMAGE_TAG }},
${{ env.ACR_REGISTRY }}/${{ github.repository }}:${{ env.PROGRAM_VERSION }},
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}