Skip to content

Workflow file for this run

name: Build and Push
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build_and_push:
name: Build and Push
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to aliyuncs Container Registry
uses: docker/login-action@v3
with:
registry: registry.cn-hangzhou.aliyuncs.com
username: ${{ secrets.ALIYUNCS_USERNAME }}
password: ${{ secrets.ALIYUNCS_PASSWORD }}
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
sunwuyuan/zerocat
ghcr.io/${{ github.repository }}
registry.cn-hangzhou.aliyuncs.com/zerocat/zerocat
tags: |
type=sha
flavor: |
latest=true
- name: Build and push Docker images
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# 这是部署CI
# deploy:
# name: deploy
# runs-on: ubuntu-latest
# steps:
# - name: deploy
# uses: appleboy/[email protected]
# with:
# host: ${{ secrets.HOST }}
# username: ${{ secrets.USERNAME }}
# password: ${{ secrets.PASSWORD }}
# port: ${{ secrets.PORT }}
# script: docker pull sunwuyuan/zerocat:latest && cd /opt/1panel/docker/compose/zerocat && docker compose up -d && cd /opt/1panel/apps/openresty/openresty/www/sites/zerocatstatic/index/StaticFile && git pull