fix:订正 tag 错误 #5
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 to Server | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: 设置 Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: 登录 Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: 构建 & 推送镜像 | |
id: build-and-push | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
tags: lihazi/weilai:latest | |
- name: executing remote ssh commands using password | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USERNAME }} | |
password: ${{ secrets.SSH_PASSWORD }} | |
port: ${{ secrets.SSH_PORT }} | |
script: | | |
docker pull lihazi/weilai | |
docket stop lihazi/weilai || true | |
docker rm lihazi/weilai || true | |
docker run -d -t lihazi/weilai -p 80:80 lihazi/weilai |