mirror of
https://github.com/m1ngsama/FUJI.git
synced 2025-12-24 10:51:27 +00:00
68 lines
1.7 KiB
YAML
68 lines
1.7 KiB
YAML
name: main
|
|
|
|
on:
|
|
push:
|
|
branches: ["main", "dev", "feature-*"]
|
|
paths-ignore: # 忽略的文件
|
|
- "README.md"
|
|
- "LICENSE"
|
|
- "CHANGELOG.md"
|
|
pull_request:
|
|
branches: ["main"]
|
|
|
|
env:
|
|
REGISTRY: ghcr.io
|
|
IMAGE_NAME: home
|
|
IMAGE_NAME_FULL: ghcr.io/nbtca/home
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
no-cache: true
|
|
platforms: linux/amd64
|
|
tags: |
|
|
${{ env.IMAGE_NAME_FULL }}:${{ github.ref_name }}
|
|
|
|
build-and-push:
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Login
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build and Push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
no-cache: true
|
|
push: true
|
|
platforms: linux/amd64
|
|
tags: |
|
|
${{ env.IMAGE_NAME_FULL }}:${{ github.ref_name }}
|
|
|
|
- name: Deploy
|
|
uses: appleboy/ssh-action@v1.0.0
|
|
env:
|
|
BRANCH_NAME: ${{ github.ref_name }}
|
|
with:
|
|
host: ${{ secrets.REMOTE_HOST }}
|
|
username: ${{ secrets.REMOTE_USER }}
|
|
key: ${{ secrets.ACCESS_TOKEN }}
|
|
envs: BRANCH_NAME
|
|
script: |
|
|
cd ${{ github.ref == 'refs/heads/main' && secrets.REMOTE_PATH || secrets.REMOTE_PATH_DEVELOPMENT }}
|
|
docker compose up --force-recreate -d --pull=always
|