Skip to content

Update releases for aboutcode-org/purlvalidator-go #42

Update releases for aboutcode-org/purlvalidator-go

Update releases for aboutcode-org/purlvalidator-go #42

Workflow file for this run

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 }}/