feat: add subject mapping guide #40
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Surge Preview | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| pr_number: | |
| description: 'PR number (used for deploy domain: opentdf-docs-pr-{number}.surge.sh)' | |
| required: true | |
| teardown: | |
| description: 'Tear down the preview instead of deploying' | |
| type: boolean | |
| default: false | |
| pull_request: | |
| types: [opened, synchronize, reopened, closed] | |
| paths: | |
| - 'docs/**' | |
| - 'code_samples/**' | |
| - 'src/**' | |
| - 'static/**' | |
| - 'blog/**' | |
| - 'specs/**' | |
| - 'docusaurus.config.ts' | |
| - 'sidebars.js' | |
| jobs: | |
| deploy-preview: | |
| if: github.event.action != 'closed' && (github.event_name != 'workflow_dispatch' || inputs.teardown == false) | |
| name: Deploy Preview | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build website | |
| run: npm run build | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Deploy to Surge | |
| run: npx surge build/ https://opentdf-docs-pr-${{ inputs.pr_number || github.event.number }}.surge.sh | |
| env: | |
| SURGE_LOGIN: ${{ secrets.SURGE_LOGIN }} | |
| SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} | |
| - name: Comment with preview URL | |
| if: github.event.action == 'opened' || github.event.action == 'reopened' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: '📄 Preview deployed to https://opentdf-docs-pr-${{ inputs.pr_number || github.event.number }}.surge.sh' | |
| }) | |
| teardown-preview: | |
| if: github.event.action == 'closed' || (github.event_name == 'workflow_dispatch' && inputs.teardown == true) | |
| name: Teardown Preview | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Teardown Surge preview | |
| run: npx surge teardown opentdf-docs-pr-${{ inputs.pr_number || github.event.number }}.surge.sh | |
| env: | |
| SURGE_LOGIN: ${{ secrets.SURGE_LOGIN }} | |
| SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} |