Skip to content

Commit 96ad617

Browse files
committed
Add Dev Deploy
1 parent 57b61c9 commit 96ad617

File tree

2 files changed

+126
-8
lines changed

2 files changed

+126
-8
lines changed

.github/workflows/dev.yaml

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
name: "Dev"
2+
3+
on:
4+
push:
5+
paths:
6+
- ".github/workflows/dev.yaml"
7+
- ".vitepress/**"
8+
- "docs/**"
9+
- "package*.json"
10+
workflow_dispatch:
11+
12+
env:
13+
SSH_HOST: ${{ secrets.DEV_DEPLOY_HOST }}
14+
SSH_PORT: ${{ secrets.DEV_DEPLOY_PORT }}
15+
SSH_USER: ${{ secrets.DEV_DEPLOY_USER }}
16+
SSH_PASS: ${{ secrets.DEV_DEPLOY_PASS }}
17+
SSH_DEST: /static
18+
19+
concurrency:
20+
group: dev
21+
cancel-in-progress: false
22+
23+
jobs:
24+
build:
25+
name: "Build"
26+
runs-on: ubuntu-latest
27+
timeout-minutes: 10
28+
29+
permissions:
30+
contents: read
31+
32+
steps:
33+
- name: "Checkout"
34+
uses: actions/checkout@v5
35+
with:
36+
fetch-depth: 0
37+
38+
- name: "Setup Node 24"
39+
uses: actions/setup-node@v6
40+
with:
41+
node-version: 24
42+
43+
- name: "Install Dependencies"
44+
run: |
45+
npm ci
46+
47+
- name: "Run Build"
48+
run: |
49+
npm run docs:build
50+
51+
- name: "Upload Artifact"
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: "artifact"
55+
path: .vitepress/dist
56+
57+
deploy:
58+
name: "Deploy"
59+
runs-on: ubuntu-latest
60+
timeout-minutes: 5
61+
needs: build
62+
63+
permissions:
64+
pages: write
65+
id-token: write
66+
67+
environment:
68+
name: dev
69+
url: https://dev-static.cssnr.com/
70+
71+
steps:
72+
- name: "Debug Variables"
73+
continue-on-error: true
74+
run: |
75+
echo "env.SSH_HOST: ${{ env.SSH_HOST }}"
76+
echo "env.SSH_PORT: ${{ env.SSH_PORT }}"
77+
echo "env.SSH_USER: ${{ env.SSH_USER }}"
78+
echo "env.SSH_PASS: ${{ env.SSH_PASS }}"
79+
echo "env.SSH_DEST: ${{ env.SSH_DEST }}"
80+
81+
- name: "Download Artifact"
82+
uses: actions/download-artifact@v5
83+
with:
84+
name: "artifact"
85+
86+
- name: "Debug Artifact"
87+
continue-on-error: true
88+
run: |
89+
cat robots.txt
90+
echo "----------"
91+
tree .
92+
93+
- name: "Setup SSH"
94+
run: |
95+
mkdir -p "${HOME}/.ssh"
96+
chmod 0700 "${HOME}/.ssh"
97+
ssh-keyscan -p "${{ env.SSH_PORT }}" -H "${{ env.SSH_HOST }}" \
98+
| tee -a "${HOME}/.ssh/known_hosts"
99+
100+
- name: "No Rubbits"
101+
run: |
102+
cat <<EOF > robots.txt
103+
User-agent: *
104+
Disallow: /
105+
EOF
106+
107+
- name: "Deploy Artifact"
108+
env:
109+
SSHPASS: ${{ env.SSH_PASS }}
110+
run: |
111+
sshpass -e rsync -aPvh --delete -e 'ssh -p ${{ env.SSH_PORT }}' \
112+
./ "${{ env.SSH_USER }}"@"${{ env.SSH_HOST }}":"${{ env.SSH_DEST }}"
113+
114+
- name: "Send Discord Notification"
115+
uses: sarisia/actions-status-discord@v1
116+
with:
117+
webhook: ${{ secrets.DISCORD_WEBHOOK }}
118+
description: "https://dev-static.cssnr.com/"

.github/workflows/pages.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
name: "Pages"
22

33
on:
4-
push:
5-
branches:
6-
- "master"
7-
paths:
8-
- "docs/**"
9-
- ".vitepress/**"
10-
- "package.json"
11-
- ".github/workflows/pages.yaml"
124
workflow_dispatch:
5+
#push:
6+
# branches:
7+
# - "master"
8+
# paths:
9+
# - "docs/**"
10+
# - ".vitepress/**"
11+
# - "package.json"
12+
# - ".github/workflows/pages.yaml"
1313

1414
env:
1515
CRAWLER_ID: "7a46f2b7-7169-4936-986d-21391c3134d4"

0 commit comments

Comments
 (0)