Skip to content

update branches to master #1

update branches to master

update branches to master #1

name: Docker Image CI/CD
on:
push:
paths-ignore: # 忽略一些不必要的文件
- ".gitignore"
- "README.md"
- ".vscode/**"
branches: [ "master" ]
#tags: # 当我们提交代码为tag 是以'v'开头的时候才会触发自动部署到服务端
# - 'v*'
jobs:
docker-image-build-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '11'
cache: 'maven'
cache-dependency-path: 'pom.xml' # optional
- uses: docker/login-action@v1
with:
registry: ghcr.io # 声明镜像源
username: ${{ github.actor }}
password: ${{ secrets.HUB_GITHUB_ACCESS_TOKEN }}
- uses: docker/login-action@v1
with:
registry: ${{ secrets.TC_DOCKER_HUB_ADDRESS }} # 声明镜像源
username: ${{ secrets.TC_DOCKER_HUB_USERNAME }}
password: ${{ secrets.TC_DOCKER_HUB_PASSWORD }}
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Build docker image
run:
docker buildx build --file Dockerfile --tag rulateday-api-server-uat:latest .
- name: create ghcr tag
run: docker image tag rulateday-api-server-uat:latest ghcr.io/rulateday/rulateday-api-server-uat:latest
- name: ghcr.io push image
run: docker push ghcr.io/rulateday/rulateday-api-server-uat:latest
- name: create tencent docker hub tag
run: docker image tag rulateday-api-server-uat:latest ${{ secrets.TC_DOCKER_HUB_ADDRESS }}/rulateday/rulateday-api-server-uat:latest
- name: tencent push image
run: docker push ${{ secrets.TC_DOCKER_HUB_ADDRESS }}/rulateday/rulateday-api-server-uat:latest