forked from mjackson/unpkg
-
Notifications
You must be signed in to change notification settings - Fork 5
108 lines (99 loc) · 3.01 KB
/
docker-deploy.yml
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: deploy to docker hub
on:
push:
tags:
- "v*.*.*"
branches:
- 'master'
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ${{ secrets.REGISTRY }}
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
jobs:
docker-deploy:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
-
uses: actions/setup-node@v4
with:
cache: "pnpm"
-
name: Setup timezone
uses: szenius/set-timezone@v1.2
with:
timezoneLinux: Asia/Shanghai
-
name: Install dependencies
run: |
pnpm install
pnpm build
rm -rf tmp
mkdir tmp
cp package.json tmp
cd tmp
npm install --omit dev
pnpm dlx @lzwme/fed-lint-helper rm -f "node_modules/**/{license,LICENSE,README.md,readme.md,.*,*.d.ts,*.flow,*.map}"
# -
# name: Set up QEMU
# uses: docker/setup-qemu-action@v3
# -
# name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3
-
name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_NAME }}
tags: |
# set latest tag for default branch
type=raw,value=latest,enable={{is_default_branch}}
# tag event
type=ref,enable=true,priority=600,prefix=,suffix=,event=tag
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
# registry: ghcr.io # 声明镜像源
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Build and push
id: docker_build
uses: docker/build-push-action@v5
with:
context: .
# platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# -
# name: Login to Docker Hub
# run: |
# docker login --username=${{ secrets.DOCKER_USERNAME }} --password ${{ secrets.DOCKER_PASSWORD }} ${{ env.REGISTRY }}
# -
# name: Build and push Docker Image
# run: |
# docker build -t ${{ env.REGISTRY }}/${{ steps.meta.outputs.tags }} -f Dockerfile .
# docker push ${{ env.REGISTRY }}/${{ steps.meta.outputs.tags }}
# -
# name: Deploy Docker App
# uses: appleboy/ssh-action@master
# env:
# TZ: Asia/Shanghai
# with:
# host: ${{ secrets.HOST }}
# username: ${{ secrets.HOST_USERNAME }}
# key: ${{ secrets.HOST_SSHKEY }}
# port: ${{ secrets.PORT }}
# script: |
# wget https://raw.githubusercontent.com/${{ env.IMAGE_NAME }}/master/docker/docker-compose.yml
# ls
# cat docker-compose.yml
# docker-compose down -v
# docker-compose up -d