Update pipeline #53
Workflow file for this run
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: deploy | |
on: | |
push: | |
branches: | |
- v2 | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: sunday | |
IMAGE_NAME_FULL: ghcr.io/nbtca/sunday | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# 切换分支 | |
- name: Checkout | |
uses: actions/checkout@master | |
- name: Login DockerHub | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and Push to DockerHub | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./Dockerfile | |
no-cache: true | |
# target: deploy | |
push: true | |
platforms: linux/amd64 | |
tags: | | |
${{ env.IMAGE_NAME_FULL }}:latest | |
- name: ssh pipelines | |
uses: cross-the-world/ssh-pipeline@master | |
with: | |
host: ${{ secrets.REMOTE_HOST }} | |
user: ${{ secrets.REMOTE_USER }} | |
key: ${{ secrets.ACCESS_TOKEN }} | |
connect_timeout: 10s | |
script: | | |
cd /home/nbtca/weekend/sunday | |
docker-compose stop && docker-compose rm -f | |
docker rmi ${{ env.IMAGE_NAME_FULL }}:latest | |
docker-compose up -d |