fix: 修正签到时间的处理,确保计算正确 #13
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 Build on Commit | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'Dockerfile' | |
- 'docker-compose.yml' | |
- '**.py' | |
- 'requirements.txt' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 检出代码 | |
uses: actions/checkout@v3 | |
- name: 设置 Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: 登录到 Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ vars.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: 获取短 SHA | |
id: vars | |
run: echo "GIT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
- name: 构建并推送 Docker 镜像 | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: true | |
tags: | | |
${{ vars.DOCKERHUB_USERNAME }}/xybotv2:latest | |
${{ vars.DOCKERHUB_USERNAME }}/xybotv2:${{ env.GIT_SHA }} | |
cache-from: type=registry,ref=${{ vars.DOCKERHUB_USERNAME }}/xybotv2:latest | |
cache-to: type=inline |