Merge pull request #60 from nbtca/dependabot/npm_and_yarn/npm_and_yar… #207
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: main | |
on: | |
push: | |
branches: ["main", "dev", "feature-*"] | |
paths-ignore: # 忽略的文件 | |
- "README.md" | |
- "LICENSE" | |
- "CHANGELOG.md" | |
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 }} | |
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/[email protected] | |
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 |