Skip to content

Deploy ApiDOM Playground #3040

Deploy ApiDOM Playground

Deploy ApiDOM Playground #3040

Workflow file for this run

# inspired by https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
name: Deploy ApiDOM Playground
on:
workflow_run:
workflows: ["ApiDOM Monorepo Build"]
types:
- completed
branches:
- main
jobs:
deploy:
if: >
${{ github.event.workflow_run.event == 'push' &&
github.ref == 'refs/heads/main' &&
github.event.workflow_run.conclusion == 'success' }}
name: Deploy ApiDOM Playground
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 'Download build artifact'
uses: actions/github-script@v7
with:
script: |
const allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
const matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "build"
})[0];
const download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
const fs = require('fs');
fs.writeFileSync('${{github.workspace}}/build.zip', Buffer.from(download.data));
- run: |
mkdir deploy-dir
unzip build.zip -d deploy-dir
- name: Deploy 🚀
uses: JamesIves/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages # The branch the action should deploy to.
folder: deploy-dir # The folder the action should deploy.
clean: true # Automatically remove deleted files from the deploy branch