Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 108 additions & 0 deletions .github/backup/dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: "Dev"

on:
workflow_dispatch:
push:
#branches-ignore: ["master"]
paths:
- ".github/workflows/dev.yaml"
- ".vitepress/**"
- "docs/**"
- "package*.json"

env:
SSH_HOST: ${{ secrets.DEV_DEPLOY_HOST }}
SSH_PORT: ${{ secrets.DEV_DEPLOY_PORT }}
SSH_USER: ${{ secrets.DEV_DEPLOY_USER }}
SSH_PASS: ${{ secrets.DEV_DEPLOY_PASS }}
SSH_DEST: /static

concurrency:
group: dev
cancel-in-progress: true

jobs:
build:
name: "Build"
runs-on: ubuntu-latest
timeout-minutes: 10

if: ${{ !contains(github.event.head_commit.message, '#nodev') }}

steps:
- name: "Checkout"
uses: actions/checkout@v5
with:
fetch-depth: 0

- name: "Debug CTX github"
continue-on-error: true
env:
GITHUB_CTX: ${{ toJSON(github) }}
run: echo "$GITHUB_CTX"

- name: "Setup Node 24"
uses: actions/setup-node@v6
with:
node-version: 24

- name: "Install Dependencies"
run: |
npm ci

- name: "Run Build"
run: |
npm run build

- name: "Upload Artifact"
uses: actions/upload-artifact@v4
with:
name: "artifact"
path: .vitepress/dist

deploy:
name: "Deploy"
runs-on: ubuntu-latest
timeout-minutes: 5
needs: build

environment:
name: dev
url: https://dev-static.cssnr.com/

steps:
- name: "Download Artifact"
uses: actions/download-artifact@v5
with:
name: "artifact"

- name: "Debug Artifact"
continue-on-error: true
run: |
tree .

- name: "No Robots"
run: |
cat <<EOF > robots.txt
User-agent: *
Disallow: /
EOF

- name: "Setup SSH"
run: |
mkdir -p "${HOME}/.ssh" && chmod 0700 "${HOME}/.ssh"
ssh-keyscan -p "${{ env.SSH_PORT }}" -H "${{ env.SSH_HOST }}" \
| tee -a "${HOME}/.ssh/known_hosts"

- name: "Deploy Artifact"
env:
SSHPASS: ${{ env.SSH_PASS }}
run: |
sshpass -e rsync -aPvh --delete -e 'ssh -p ${{ env.SSH_PORT }}' \
./ "${{ env.SSH_USER }}"@"${{ env.SSH_HOST }}":"${{ env.SSH_DEST }}"

- name: "Send Discord Notification"
uses: sarisia/actions-status-discord@v1
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
description: "https://dev-static.cssnr.com/"
122 changes: 122 additions & 0 deletions .github/backup/pages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
name: "Pages"

on:
workflow_dispatch:
#push:
# branches: ["master"]
# paths:
# - ".github/workflows/pages.yaml"
# - ".vitepress/**"
# - "docs/**"
# - "package*.json"

env:
crawler-id: "c294cc15-d908-4f35-a87c-c05e44904c16"
purge-domain: ""

concurrency:
group: pages
cancel-in-progress: false

jobs:
build:
name: "Build"
runs-on: ubuntu-latest
timeout-minutes: 10

if: ${{ !contains(github.event.head_commit.message, '#nodeploy') }}

steps:
- name: "Checkout"
uses: actions/checkout@v5
with:
fetch-depth: 0

- name: "Debug CTX github"
continue-on-error: true
env:
GITHUB_CTX: ${{ toJSON(github) }}
run: echo "$GITHUB_CTX"

- name: "Setup Node 24"
uses: actions/setup-node@v6
with:
node-version: 24

- name: "Configure Pages"
uses: actions/configure-pages@v5

- name: "Install Dependencies"
run: |
npm ci

- name: "Run Build"
run: |
npm run build

- name: "Upload Pages Artifact"
uses: actions/upload-pages-artifact@v4
with:
path: .vitepress/dist

- name: "Send Failure Notification"
if: ${{ failure() }}
uses: sarisia/actions-status-discord@v1
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}

deploy:
name: "Deploy"
runs-on: ubuntu-latest
timeout-minutes: 5
needs: build

permissions:
pages: write
id-token: write

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

steps:
- name: "Deploy Pages"
id: deployment
uses: actions/deploy-pages@v4

- name: "Send Deploy Notification"
if: ${{ !cancelled() }}
continue-on-error: true
uses: sarisia/actions-status-discord@v1
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
description: ${{ steps.deployment.outputs.page_url }}

post:
name: "Post-Deploy"
runs-on: ubuntu-latest
timeout-minutes: 5
needs: deploy

steps:
- name: "Purge Cache"
if: ${{ env.purge-domain != '' }}
uses: cssnr/cloudflare-purge-cache-action@v2
with:
zones: ${{ env.purge-domain }}
token: ${{ secrets.CLOUDFLARE_API_TOKEN }}

- name: "Algolia Crawler"
if: ${{ env.crawler-id != '' }}
uses: cssnr/algolia-crawler-action@v1
with:
crawler_id: ${{ env.crawler-id }}
crawler_user_id: ${{ secrets.CRAWLER_USER_ID }}
crawler_api_key: ${{ secrets.CRAWLER_API_KEY }}

- name: "Send Post-Deploy Notification"
if: ${{ failure() }}
uses: sarisia/actions-status-discord@v1
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
description: ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}
107 changes: 22 additions & 85 deletions .github/workflows/dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,106 +3,43 @@ name: "Dev"
on:
workflow_dispatch:
push:
#branches-ignore: ["master"]
branches-ignore: [master]
paths:
- ".github/workflows/dev.yaml"
- ".vitepress/**"
- "docs/**"
- "package*.json"

env:
SSH_HOST: ${{ secrets.DEV_DEPLOY_HOST }}
SSH_PORT: ${{ secrets.DEV_DEPLOY_PORT }}
SSH_USER: ${{ secrets.DEV_DEPLOY_USER }}
SSH_PASS: ${{ secrets.DEV_DEPLOY_PASS }}
SSH_DEST: /static

concurrency:
group: dev
cancel-in-progress: true

jobs:
build:
name: "Build"
runs-on: ubuntu-latest
timeout-minutes: 10

if: ${{ !contains(github.event.head_commit.message, '#nodev') }}

steps:
- name: "Checkout"
uses: actions/checkout@v5
with:
fetch-depth: 0

- name: "Debug CTX github"
continue-on-error: true
env:
GITHUB_CTX: ${{ toJSON(github) }}
run: echo "$GITHUB_CTX"

- name: "Setup Node 24"
uses: actions/setup-node@v6
with:
node-version: 24

- name: "Install Dependencies"
run: |
npm ci

- name: "Run Build"
run: |
npm run build

- name: "Upload Artifact"
uses: actions/upload-artifact@v4
with:
name: "artifact"
path: .vitepress/dist
uses: cssnr/workflows/.github/workflows/npm-build.yaml@master
permissions:
contents: read
with:
build: "npm run build"
path: ".vitepress/dist"
secrets:
webhook: ${{ secrets.DISCORD_WEBHOOK }}

deploy:
name: "Deploy"
runs-on: ubuntu-latest
timeout-minutes: 5
uses: cssnr/workflows/.github/workflows/deploy-static.yaml@master
needs: build

environment:
name: dev
url: https://dev-static.cssnr.com/

steps:
- name: "Download Artifact"
uses: actions/download-artifact@v5
with:
name: "artifact"

- name: "Debug Artifact"
continue-on-error: true
run: |
tree .

- name: "No Robots"
run: |
cat <<EOF > robots.txt
User-agent: *
Disallow: /
EOF

- name: "Setup SSH"
run: |
mkdir -p "${HOME}/.ssh" && chmod 0700 "${HOME}/.ssh"
ssh-keyscan -p "${{ env.SSH_PORT }}" -H "${{ env.SSH_HOST }}" \
| tee -a "${HOME}/.ssh/known_hosts"

- name: "Deploy Artifact"
env:
SSHPASS: ${{ env.SSH_PASS }}
run: |
sshpass -e rsync -aPvh --delete -e 'ssh -p ${{ env.SSH_PORT }}' \
./ "${{ env.SSH_USER }}"@"${{ env.SSH_HOST }}":"${{ env.SSH_DEST }}"

- name: "Send Discord Notification"
uses: sarisia/actions-status-discord@v1
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
description: "https://dev-static.cssnr.com/"
permissions:
contents: read
with:
name: "dev"
url: "https://dev-static.cssnr.com/"
robots: true
secrets:
host: ${{ secrets.DEV_DEPLOY_HOST }}
port: ${{ secrets.DEV_DEPLOY_PORT }}
user: ${{ secrets.DEV_DEPLOY_USER }}
pass: ${{ secrets.DEV_DEPLOY_PASS }}
webhook: ${{ secrets.DISCORD_WEBHOOK }}
Loading