Deploy previews and comment on PR #1562
This file contains 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
# ------------------------------------------------------------------------------------------------- | |
# This workflow is meant to be copied to the preview repo, in order to handle the actual GitHub | |
# Pages deployment, along with any other accessory operation, like commenting on a PR. | |
# Source: https://github.com/EndBug/pages-preview | |
# ------------------------------------------------------------------------------------------------- | |
name: Deploy previews and comment on PR | |
on: | |
workflow_dispatch: | |
inputs: | |
ref: | |
description: 'The ref to deploy' | |
required: true | |
type: string | |
version: | |
description: 'The version of EndBug/pages-preview that triggered the workflow' | |
required: true | |
type: string | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
# VERSION: update before changing the major version | |
version-check: | |
name: Check action version | |
runs-on: ubuntu-latest | |
steps: | |
- run: | | |
if [ "${{ github.event.inputs.version }}" != "v1" ]; then | |
echo "This workflow is meant to be used with EndBug/pages-preview@v1, please update your action." | |
exit 1 | |
fi | |
deploy: | |
name: Deploy previews to GitHub Pages | |
runs-on: ubuntu-latest | |
needs: version-check | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ inputs.ref }} | |
- uses: actions/configure-pages@v2 | |
- uses: actions/upload-pages-artifact@v1 | |
with: | |
path: '.' | |
- id: deployment | |
uses: actions/deploy-pages@v1 |