Skip to content

Recipe: indentation-sensitive languages #184

Recipe: indentation-sensitive languages

Recipe: indentation-sensitive languages #184

Workflow file for this run

name: Deploy PR previews
on:
pull_request_target:
types:
- opened
- synchronize
- reopened
- closed
concurrency: preview-${{ github.head_ref }}
defaults:
run:
shell: bash
jobs:
build-preview:
if: github.event_name == 'pull_request_target' && github.event.action != 'closed'
runs-on: ubuntu-latest
steps:
- name: Use Node.js
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3.8.2
with:
node-version: '18'
- name: Checkout
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Build
run: |
npm install
npm run build
- name: Upload artifact
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: "site"
path: ./public
deploy-preview:
needs: build-preview
runs-on: ubuntu-latest
permissions:
pull-requests: write
environment:
name: pull-request-preview
url: ${{ steps.deployment.outputs.deployment-url }}
steps:
# checkout required for pr-preview-action to succeed,
# while the content will not be used
- name: Checkout
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: Download the preview page
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: "site"
path: ./public
- uses: rossjrw/pr-preview-action@4668d7cb417ce7067b0b59bc152b1ae1513010de # v1.4.6
id: deployment
with:
source-dir: ./public
preview-branch: previews
umbrella-dir: pr-previews
deploy-repository: eclipse-langium/langium-previews
token: ${{ secrets.DEPLOY_PREVIEW_TOKEN }}
action: auto
# remove the preview page when the PR got closed
remove-preview:
if: github.event_name == 'pull_request_target' && github.event.action == 'closed'
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
# checkout required for pr-preview-action to succeed,
# while the content will not be used
- name: Checkout
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- uses: rossjrw/pr-preview-action@4668d7cb417ce7067b0b59bc152b1ae1513010de # v1.4.6
id: deployment
with:
preview-branch: previews
umbrella-dir: pr-previews
deploy-repository: eclipse-langium/langium-previews
token: ${{ secrets.DEPLOY_PREVIEW_TOKEN }}
action: auto