generated from EndBug/preview-template
-
Notifications
You must be signed in to change notification settings - Fork 2
60 lines (52 loc) · 1.67 KB
/
preview.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# -------------------------------------------------------------------------------------------------
# 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