Build Docker Image #355
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: Build Docker Image | |
on: | |
push: | |
branches: | |
- main | |
- master | |
watch: | |
types: [started] | |
release: | |
types: [published] | |
schedule: | |
# * is a special character in YAML so you have to quote this string | |
# UTC 17:00 -> CST (China) 1:00, see https://datetime360.com/cn/utc-cst-china-time/ | |
# - cron: '0 17 * * *' | |
# 每月最后一天10:15分运行 | |
# - cron: '0 15 10 L * ?' | |
# 每月第一天0:0分运行 | |
- cron: '0 0 1 * *' | |
workflow_dispatch: | |
jobs: | |
buildx: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# Docker Image 构建环境 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
# ReleaseTag | |
- name: Set Version | |
id: set-version | |
run: | | |
echo "version=`date +'%y-%m-%d'`" >> $GITHUB_ENV | |
# Build and push | |
- name: Build dockerfile | |
uses: docker/build-push-action@v6 | |
with: | |
file: ./Dockerfile | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
# platforms: linux/amd64 | |
push: true | |
tags: | | |
bloodstar/hexo:stable-${{ env.version }} | |
bloodstar/hexo:latest | |