Skip to content

Surge PR Preview

Surge PR Preview #691

Workflow file for this run

name: Surge PR Preview
on:
workflow_run:
workflows: [ "Build" ]
types:
- completed
branches-ignore:
- "main"
permissions:
actions: read
pull-requests: write
jobs:
preview:
runs-on: ubuntu-latest
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
steps:
- name: Download PR Artifact
uses: actions/download-artifact@v8
with:
github-token: ${{ github.token }}
run-id: ${{ github.event.workflow_run.id }}
name: site
- name: Store PR id as variable
id: pr
run: |
echo "id=$(<pr-id.txt)" >> $GITHUB_OUTPUT
rm -f pr-id.txt
- name: Trim site for preview
run: |
cd super-heroes/variants
rm -rf os-linux-* os-windows-*
du -sh ..
- name: Publishing to surge for preview
id: deploy
run: npx surge@0.23.1 ./ --domain quarkus-workshops-pr-${{ steps.pr.outputs.id }}-preview.surge.sh --token ${{ secrets.SURGE_TOKEN }}
- name: Update PR status comment on success
uses: quarkusio/action-helpers@main
with:
action: maintain-one-comment
github-token: ${{ secrets.GITHUB_TOKEN }}
body: |
🚀 PR Preview ${{ github.sha }} has been successfully built and deployed to https://quarkus-workshops-pr-${{ steps.pr.outputs.id }}-preview.surge.sh. Note that in order to limit the site size, not all variants are deployed.
body-marker: '<!-- Sticky Pull Request Comment -->'
pr-number: ${{ steps.pr.outputs.id }}
- name: Update PR status comment on failure
uses: quarkusio/action-helpers@main
if: ${{ failure() }}
with:
action: maintain-one-comment
github-token: ${{ secrets.GITHUB_TOKEN }}
body: |
😭 Deploy PR Preview failed.
body-marker: '<!-- Sticky Pull Request Comment -->'
pr-number: ${{ steps.pr.outputs.id }}