Skip to content

Commit 55c32fa

Browse files
authored
Updates (#5)
1 parent 88609bd commit 55c32fa

File tree

4 files changed

+167
-0
lines changed

4 files changed

+167
-0
lines changed

.github/workflows/dev.yaml

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

.github/workflows/pages.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ jobs:
6969
name: github-pages
7070
url: ${{ steps.deployment.outputs.page_url }}
7171

72+
outputs:
73+
page_url: ${{ steps.deployment.outputs.page_url }}
74+
7275
steps:
7376
- name: "Deploy Pages"
7477
id: deployment
@@ -101,3 +104,4 @@ jobs:
101104
uses: sarisia/actions-status-discord@v1
102105
with:
103106
webhook: ${{ secrets.DISCORD_WEBHOOK }}
107+
description: ${{ needs.deploy.outputs.page_url }}

.vitepress/theme/Layout.vue

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<script setup>
2+
import DefaultTheme from 'vitepress/theme'
3+
4+
const { Layout } = DefaultTheme
5+
</script>
6+
7+
<template>
8+
<Layout>
9+
<template #home-features-after>
10+
<div class="features-after">
11+
<a href="https://ko-fi.com/cssnr" target="_blank" rel="noopener">
12+
<img alt="Ko-Fi" src="/images/ko-fi.gif" />
13+
</a>
14+
</div>
15+
</template>
16+
</Layout>
17+
</template>
18+
19+
<!--suppress CssUnusedSymbol -->
20+
<style scoped>
21+
.features-after {
22+
margin-top: 64px;
23+
padding: 0 24px;
24+
text-align: center;
25+
}
26+
.features-after img {
27+
margin: auto;
28+
display: inline-block;
29+
vertical-align: middle;
30+
/* transform: translateZ(0);*/
31+
/* box-shadow: 0 0 1px rgba(0, 0, 0, 0);*/
32+
/* backface-visibility: hidden;*/
33+
/* -moz-osx-font-smoothing: grayscale;*/
34+
/* transition-duration: 0.3s;*/
35+
/* transition-property: transform;*/
36+
/*}*/
37+
/*.features-after img:hover {*/
38+
/* transform: scale(1.02);*/
39+
}
40+
</style>

.vitepress/theme/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import DefaultTheme, { VPBadge } from 'vitepress/theme'
22
import './custom.css'
33

4+
// import Layout from './Layout.vue'
5+
46
import BrowserIcons from './components/BrowserIcons.vue'
57
import VPCardLink from './components/VPCardLink.vue'
68

@@ -20,6 +22,8 @@ import '@cssnr/vitepress-swiper/style.css'
2022
export default {
2123
...DefaultTheme,
2224

25+
// Layout: Layout,
26+
2327
enhanceApp({ app }) {
2428
app.component('Badge', VPBadge)
2529

0 commit comments

Comments
 (0)