mirror of
https://github.com/Anduin2017/HowToCook.git
synced 2026-01-12 18:27:20 +08:00
61 lines
1.7 KiB
YAML
61 lines
1.7 KiB
YAML
name: Continuous Deployment
|
|
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
workflow_dispatch:
|
|
|
|
|
|
jobs:
|
|
build-readme-file:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
# Checkout, install tools..
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
token: ${{ secrets.PAT }}
|
|
- uses: actions/setup-node@v2
|
|
with:
|
|
node-version: '16'
|
|
cache: 'npm'
|
|
- run: npm install
|
|
- run: npm run build
|
|
- run: npm run lint
|
|
# Save files.
|
|
- uses: stefanzweifel/git-auto-commit-action@v4
|
|
with:
|
|
commit_message: '[ci skip] Automatic file changes/fix'
|
|
branch: 'master'
|
|
file_pattern: ':/*.*'
|
|
commit_user_name: github-actions[bot]
|
|
commit_user_email: github-actions[bot]@users.noreply.github.com
|
|
commit_author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
|
|
|
|
build-docker-image:
|
|
needs: build-readme-file
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
# Checkout, install tools..
|
|
- uses: actions/checkout@v2
|
|
|
|
# 设置Docker BuildX
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
# Login to GitHub Container Registry
|
|
- name: Login to GitHub Container Registry
|
|
uses: docker/login-action@v1
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
# 构建并推送多架构Docker镜像
|
|
- name: Build and push multi-arch Docker image
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
context: .
|
|
push: true
|
|
platforms: linux/amd64,linux/arm64
|
|
tags: |
|
|
ghcr.io/${{ github.repository }}:latest |