diff --git a/.github/workflows/deploy.yml b/.github/workflows-archive/deploy.yml similarity index 100% rename from .github/workflows/deploy.yml rename to .github/workflows-archive/deploy.yml diff --git a/.github/workflows/a-b-deploy.yml b/.github/workflows/a-b-deploy.yml new file mode 100644 index 0000000..017fcb2 --- /dev/null +++ b/.github/workflows/a-b-deploy.yml @@ -0,0 +1,125 @@ +name: Build & Deploy Docusaurus Site + +on: + push: + branches: [ main ] + + pull_request: + branches: [ main ] + + workflow_dispatch: + inputs: + target: + description: "Deploy target" + required: true + default: "gh" + type: choice + options: + - gh + - dreamhost + +permissions: + contents: read + pages: write + id-token: write + +jobs: + build: + name: Build site + runs-on: ubuntu-latest + + outputs: + deploy_target: ${{ steps.set-target.outputs.target }} + + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Set deploy target + id: set-target + run: | + if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then + echo "target=${{ inputs.target }}" >> $GITHUB_OUTPUT + else + echo "target=gh" >> $GITHUB_OUTPUT + fi + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + cache-dependency-path: website/package-lock.json + + - name: Install dependencies + run: | + cd website + npm ci + + - name: Build Docusaurus site + env: + DEPLOY_TARGET: ${{ steps.set-target.outputs.target }} + run: | + cd website + npm run build + + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: docusaurus-build + path: website/build + + + deploy-gh-pages: + name: Deploy to GitHub Pages + needs: build + if: | + needs.build.outputs.deploy_target == 'gh' && + github.event_name != 'pull_request' + runs-on: ubuntu-latest + + environment: + name: github-pages + + steps: + - name: Download build artifact + uses: actions/download-artifact@v4 + with: + name: docusaurus-build + path: build + + - name: Upload Pages artifact + uses: actions/upload-pages-artifact@v3 + with: + path: build + + - name: Deploy to GitHub Pages + uses: actions/deploy-pages@v4 + + + deploy-dreamhost: + name: Deploy to DreamHost + needs: build + if: | + needs.build.outputs.deploy_target == 'dreamhost' && + github.event_name != 'pull_request' + runs-on: ubuntu-latest + + steps: + - name: Download build artifact + uses: actions/download-artifact@v4 + with: + name: docusaurus-build + path: build + + - name: Setup SSH + run: | + mkdir -p ~/.ssh + echo "${{ secrets.DREAMHOST_SSH_KEY }}" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + ssh-keyscan -H ${{ secrets.DREAMHOST_HOST }} >> ~/.ssh/known_hosts + + - name: Deploy via rsync + run: | + rsync -avz --delete build/ \ + ${{ secrets.DREAMHOST_USER }}@${{ secrets.DREAMHOST_HOST }}:${{ secrets.DREAMHOST_PATH }}/ diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index 9901315..cddf09b 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -66,9 +66,10 @@ const config = { baseUrl: siteConfig[deployTarget].baseUrl, trailingSlash: false, + // 2026-02-20 Friday 11:02:52.No longer needed? // For GitHub pages deployment: - organizationName: 'aboutcode-org', - projectName: 'www.aboutcode.org', + // organizationName: 'aboutcode-org', + // projectName: 'www.aboutcode.org', onBrokenLinks: 'throw', // 2026-02-11 Wednesday 10:26:31. The following is deprecated, to be removed in v4, replaced with similar structure above under 'markdown:'.