@@ -3,106 +3,43 @@ name: "Dev"
33on :
44 workflow_dispatch :
55 push :
6- # branches-ignore: [" master" ]
6+ branches-ignore : [master]
77 paths :
88 - " .github/workflows/dev.yaml"
99 - " .vitepress/**"
1010 - " docs/**"
1111 - " package*.json"
1212
13- env :
14- SSH_HOST : ${{ secrets.DEV_DEPLOY_HOST }}
15- SSH_PORT : ${{ secrets.DEV_DEPLOY_PORT }}
16- SSH_USER : ${{ secrets.DEV_DEPLOY_USER }}
17- SSH_PASS : ${{ secrets.DEV_DEPLOY_PASS }}
18- SSH_DEST : /static
19-
2013concurrency :
21- group : dev
14+ group : ${{ github.workflow }}-${{ github.ref }}
2215 cancel-in-progress : true
2316
2417jobs :
2518 build :
2619 name : " Build"
27- runs-on : ubuntu-latest
28- timeout-minutes : 10
29-
3020 if : ${{ !contains(github.event.head_commit.message, '#nodev') }}
31-
32- steps :
33- - name : " Checkout"
34- uses : actions/checkout@v5
35- with :
36- fetch-depth : 0
37-
38- - name : " Debug CTX github"
39- continue-on-error : true
40- env :
41- GITHUB_CTX : ${{ toJSON(github) }}
42- run : echo "$GITHUB_CTX"
43-
44- - name : " Setup Node 24"
45- uses : actions/setup-node@v6
46- with :
47- node-version : 24
48-
49- - name : " Install Dependencies"
50- run : |
51- npm ci
52-
53- - name : " Run Build"
54- run : |
55- npm run build
56-
57- - name : " Upload Artifact"
58- uses : actions/upload-artifact@v4
59- with :
60- name : " artifact"
61- path : .vitepress/dist
21+ uses : cssnr/workflows/.github/workflows/npm-build.yaml@master
22+ permissions :
23+ contents : read
24+ with :
25+ build : " npm run build"
26+ path : " .vitepress/dist"
27+ secrets :
28+ webhook : ${{ secrets.DISCORD_WEBHOOK }}
6229
6330 deploy :
6431 name : " Deploy"
65- runs-on : ubuntu-latest
66- timeout-minutes : 5
32+ uses : cssnr/workflows/.github/workflows/deploy-static.yaml@master
6733 needs : build
68-
69- environment :
70- name : dev
71- url : https://dev-static.cssnr.com/
72-
73- steps :
74- - name : " Download Artifact"
75- uses : actions/download-artifact@v5
76- with :
77- name : " artifact"
78-
79- - name : " Debug Artifact"
80- continue-on-error : true
81- run : |
82- tree .
83-
84- - name : " No Robots"
85- run : |
86- cat <<EOF > robots.txt
87- User-agent: *
88- Disallow: /
89- EOF
90-
91- - name : " Setup SSH"
92- run : |
93- mkdir -p "${HOME}/.ssh" && chmod 0700 "${HOME}/.ssh"
94- ssh-keyscan -p "${{ env.SSH_PORT }}" -H "${{ env.SSH_HOST }}" \
95- | tee -a "${HOME}/.ssh/known_hosts"
96-
97- - name : " Deploy Artifact"
98- env :
99- SSHPASS : ${{ env.SSH_PASS }}
100- run : |
101- sshpass -e rsync -aPvh --delete -e 'ssh -p ${{ env.SSH_PORT }}' \
102- ./ "${{ env.SSH_USER }}"@"${{ env.SSH_HOST }}":"${{ env.SSH_DEST }}"
103-
104- - name : " Send Discord Notification"
105- uses : sarisia/actions-status-discord@v1
106- with :
107- webhook : ${{ secrets.DISCORD_WEBHOOK }}
108- description : " https://dev-static.cssnr.com/"
34+ permissions :
35+ contents : read
36+ with :
37+ name : " dev"
38+ url : " https://dev-static.cssnr.com/"
39+ robots : true
40+ secrets :
41+ host : ${{ secrets.DEV_DEPLOY_HOST }}
42+ port : ${{ secrets.DEV_DEPLOY_PORT }}
43+ user : ${{ secrets.DEV_DEPLOY_USER }}
44+ pass : ${{ secrets.DEV_DEPLOY_PASS }}
45+ webhook : ${{ secrets.DISCORD_WEBHOOK }}
0 commit comments