Merge pull request #26 from photon-hq/vellum-generated-events #54
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: Deploy dist | |
| on: | |
| push: | |
| branches: [main] | |
| repository_dispatch: | |
| types: [spectrum-cloud-release] | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Parse repository | |
| id: parse-repo | |
| run: | | |
| echo "owner=${GITHUB_REPOSITORY%/*}" >> "$GITHUB_OUTPUT" | |
| echo "name=${GITHUB_REPOSITORY#*/}" >> "$GITHUB_OUTPUT" | |
| - name: Generate GitHub App token | |
| id: app-token | |
| uses: actions/create-github-app-token@v1 | |
| with: | |
| app-id: ${{ secrets.APP_ID }} | |
| private-key: ${{ secrets.APP_PRIVATE_KEY }} | |
| owner: ${{ steps.parse-repo.outputs.owner }} | |
| repositories: ${{ steps.parse-repo.outputs.name }} | |
| - uses: actions/checkout@v4 | |
| with: | |
| token: ${{ steps.app-token.outputs.token }} | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24" | |
| cache: "pnpm" | |
| - run: pnpm install --frozen-lockfile | |
| - name: Generate docs from Vellum templates | |
| run: pnpm docs:generate | |
| - name: Push to dist branch | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| # Force-add all Vellum-generated files (gitignored, but needed on dist) | |
| git add -f $(find docs-src -name '*.vel' | sed 's|^docs-src/||;s|\.vel$||') | |
| # Commit onto a detached HEAD so main is untouched | |
| TREE=$(git write-tree) | |
| PARENT=$(git rev-parse HEAD) | |
| COMMIT=$(git commit-tree "$TREE" -p "$PARENT" \ | |
| -m "build: generate docs from $(git rev-parse --short HEAD)") | |
| git push "https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/${{ github.repository }}.git" \ | |
| "$COMMIT":refs/heads/dist --force |