article transferred #38
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
name: Manage Pull Request Preview Instances | |
on: | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
- closed | |
concurrency: preview-${{ github.ref }} | |
jobs: | |
deploy-ephemeral-preview: | |
name: Deploy or Remove Ephemeral Preview | |
environment: | |
name: pull-requests-preview | |
url: 'https://${{ github.repository_owner }}.github.io${{ vars.DOCUSAURUS_BASE_URL }}pr-${{ github.event.pull_request.number }}' | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get Commit Hash | |
id: commit_hash | |
uses: prompt/actions-commit-hash@v3 | |
- name: Install and Build | |
if: github.event.action != 'closed' | |
env: | |
REACT_APP_VERSION: ${{ vars.APP_VERSION }}.PR${{ github.event.pull_request.number }}-${{ github.run_number }}-${{ steps.commit_hash.outputs.short }}-ephemeral | |
REACT_APP_DOCS_NEXT_HOST: ${{ vars.DOCS_NEXT_HOST }} | |
REACT_APP_DOCS_NEXT_ORG: ${{ vars.DOCS_NEXT_ORG }} | |
REACT_APP_DOCUSAURUS_BASE_URL: ${{ vars.DOCUSAURUS_BASE_URL }}pr-${{ github.event.pull_request.number }} | |
UMAMI_WEBSITE_ID: ${{ vars.UMAMI_WEBSITE_ID }} | |
UMAMI_ANALYTICS_DOMAIN: ${{ vars.UMAMI_ANALYTICS_DOMAIN }} | |
UMAMI_DATAHOST_URL: ${{ vars.UMAMI_DATAHOST_URL }} | |
UMAMI_DATA_DOMAIN: ${{ vars.UMAMI_DATA_DOMAINS }} | |
run: | | |
npm install | |
npm run build | |
- name: Deploy preview | |
uses: rossjrw/pr-preview-action@v1 | |
with: | |
source-dir: ./build/ |