-
Notifications
You must be signed in to change notification settings - Fork 2
47 lines (42 loc) · 1.12 KB
/
main.yml
File metadata and controls
47 lines (42 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: deploy
on:
push:
branches:
- main
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: appleboy/ssh-action@v1.0.0
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.ACCESS_TOKEN }}
script: |
cd /home/nbtca/weekend/sunday
docker stack deploy -c ./compose.yaml weekend