-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support publishing of PR previews to the langium-previews repo (#210)
* Update preview workflow to publish results to the langium-previews repo; ensure that relative links are used for building the website
- Loading branch information
Showing
3 changed files
with
62 additions
and
9 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,84 @@ | ||
name: Deploy PR previews | ||
|
||
on: | ||
pull_request: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
- closed | ||
|
||
concurrency: preview-${{ github.ref }} | ||
concurrency: preview-${{ github.head_ref }} | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
deploy-preview: | ||
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@v3 | ||
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3.8.2 | ||
with: | ||
node-version: '18' | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
- name: Build | ||
run: | | ||
npm install | ||
npm run build | ||
- name: Deploy preview | ||
uses: rossjrw/pr-preview-action@v1 | ||
- 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@183082fd714654433c8e2f6daedbfb4f20f2a94a # v1.4.4 | ||
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 | ||
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@183082fd714654433c8e2f6daedbfb4f20f2a94a # v1.4.4 | ||
id: deployment | ||
with: | ||
preview-branch: previews | ||
umbrella-dir: pr-previews | ||
deploy-repository: eclipse-langium/langium-previews | ||
token: ${{ secrets.DEPLOY_PREVIEW_TOKEN }} | ||
action: auto |
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 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