Skip to content

Frontend Preview

Frontend Preview #836

name: Frontend Preview
on:
workflow_run:
workflows: ["Frontend Tests"]
types:
- completed
env:
# Workaround testsuite locale issue
LANG: en_US.UTF-8
jobs:
publish:
name: "Publish PR frontend preview to surge.sh"
runs-on: ubuntu-latest
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
steps:
- name: Download PR Artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
workflow_conclusion: success
name: build-dir
- name: Store PR id as variable
id: pr
run: |
echo "::set-output name=id::$(<pr-id.txt)"
rm -f pr-id.txt
- name: Publishing to surge for preview
id: deploy
run: npx surge ./ --domain https://code-quarkus-io-pr-${{ steps.pr.outputs.id }}-preview.surge.sh --token ${{ secrets.SURGE_TOKEN }}
- name: Update PR status comment on success
uses: actions-cool/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
body: |
🎊 PR Preview has been successfully built and deployed to https://code-quarkus-io-pr-${{ steps.pr.outputs.id }}-preview.surge.sh
<img width="300" src="https://user-images.githubusercontent.com/507615/90250366-88233900-de6e-11ea-95a5-84f0762ffd39.png">
<!-- Sticky Pull Request Comment -->
body-include: '<!-- Sticky Pull Request Comment -->'
number: ${{ steps.pr.outputs.id }}
- name: Update PR status comment on failure
if: ${{ failure() }}
uses: actions-cool/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
body: |
😭 Deploy PR Preview failed.
<img width="300" src="https://user-images.githubusercontent.com/507615/90250824-4e066700-de6f-11ea-8230-600ecc3d6a6b.png">
<!-- Sticky Pull Request Comment -->
body-include: '<!-- Sticky Pull Request Comment -->'
number: ${{ steps.pr.outputs.id }}