Merge pull request #7 from a645162/dev #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |