diff --git a/.github/workflows/dev.yaml b/.github/workflows/dev.yaml index aa69c4a..bd09808 100644 --- a/.github/workflows/dev.yaml +++ b/.github/workflows/dev.yaml @@ -10,13 +10,6 @@ on: - "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 @@ -24,85 +17,27 @@ concurrency: 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" 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 < 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 }} diff --git a/.github/workflows/pages.yaml b/.github/workflows/pages.yaml index 538d7db..b35f2a7 100644 --- a/.github/workflows/pages.yaml +++ b/.github/workflows/pages.yaml @@ -21,49 +21,14 @@ concurrency: 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 }} + uses: cssnr/workflows/.github/workflows/npm-build.yaml@master + permissions: + contents: read + with: + build: "npm run build" + path: ".vitepress/dist" + pages: true deploy: name: "Deploy"