revite/.github/workflows/preview_pull_request.yml

49 lines
1.6 KiB
YAML
Raw Normal View History

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:
folder: dist
2021-09-11 10:12:14 -04:00
branch: build-previews
2021-09-10 14:48:48 -04:00
target-folder: ${{ github.ref }}
2021-09-11 10:12:14 -04:00
single-commit: true
2021-09-10 14:48:48 -04:00
- name: send comment
uses: marocchino/sticky-pull-request-comment@v2
with:
header: Preview environment
message: |
## Preview environment
2021-09-11 10:12:14 -04:00
https://${{ github.repository_owner }}.github.io/revite/${{ github.ref }}/
2021-09-10 14:48:48 -04:00
This link will remain active until the `use-preview` label is removed.