2021-09-10 14:48:48 -04:00
|
|
|
name: Preview Pull Request
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
types: [synchronize, reopened, labeled]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
# make sure the pull request is labeled with 'use-preview'
|
|
|
|
if: github.event.label.name == 'use-preview' || contains(github.event.pull_request.labels.*.name, 'use-preview')
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
# Head commit of the pull request
|
|
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
|
|
submodules: recursive
|
|
|
|
|
|
|
|
- name: Setup Node
|
|
|
|
uses: actions/setup-node@v2
|
|
|
|
with:
|
|
|
|
node-version: 15
|
|
|
|
cache: "yarn"
|
|
|
|
|
|
|
|
- run: yarn install
|
2021-09-10 14:59:37 -04:00
|
|
|
# - run: yarn check
|
2021-09-10 14:48:48 -04:00
|
|
|
|
|
|
|
- name: build
|
2021-09-10 18:03:06 -04:00
|
|
|
run: yarn build --base "/revite/${{ github.ref }}/"
|
2021-09-10 14:48:48 -04:00
|
|
|
|
|
|
|
- name: publish preview
|
|
|
|
uses: JamesIves/github-pages-deploy-action@4.1.5
|
|
|
|
with:
|
|
|
|
branch: build-previews
|
|
|
|
folder: dist
|
|
|
|
target-folder: ${{ github.ref }}
|
|
|
|
|
|
|
|
- name: send comment
|
|
|
|
uses: marocchino/sticky-pull-request-comment@v2
|
|
|
|
with:
|
|
|
|
header: Preview environment
|
|
|
|
message: |
|
|
|
|
## Preview environment
|
|
|
|
https://${{ github.repository_owner }}.github.io/revite/${{ github.ref }}/index.html
|
|
|
|
|
|
|
|
This link will remain active until the `use-preview` label is removed.
|