feature(website): migrate bank and evidence pages #1738
Workflow file for this run
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: UI | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
env: | |
DIST_PATH: "ui/storybook-static" | |
PR_NUMBER: ${{ github.event.number }} | |
jobs: | |
check_applicability: | |
name: Check applicability | |
runs-on: ubuntu-latest | |
outputs: | |
should_skip: ${{ steps.skip_check.outputs.should_skip }} | |
steps: | |
- id: skip_check | |
uses: fkirc/skip-duplicate-actions@v5 | |
with: | |
paths: '["ui/**", "package-lock.json", ".github/workflows/ui.yml"]' | |
skip_after_successful_duplicate: "false" | |
build: | |
name: Build UI | |
runs-on: ubuntu-latest | |
needs: check_applicability | |
if: needs.check_applicability.outputs.should_skip != 'true' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Initialize repository | |
uses: ./.github/workflows/actions/init | |
- name: Set Storybook env variables | |
run: | | |
echo "$PR_NUMBER" | |
if [[ $PR_NUMBER ]]; then | |
echo 'STORYBOOK_PATH_PREFIX=/public/pr-preview/pr-${{ github.event.number }}/' >>"$GITHUB_ENV" | |
else | |
echo "STORYBOOK_PATH_PREFIX=/public/" >>"$GITHUB_ENV" | |
fi | |
- name: Build UI documentation | |
run: npm run ui:build | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: storybook-static | |
path: "${{ env.DIST_PATH }}/" | |
if-no-files-found: error | |
retention-days: 1 | |
deploy-preview: | |
name: Deploy UI preview | |
runs-on: ubuntu-latest | |
if: github.event.number # only run on PRs | |
concurrency: ui-preview-deployment-${{ github.ref }} | |
needs: build | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: storybook-static | |
path: ${{ env.DIST_PATH }} | |
- name: Deploy preview to GitHub Pages | |
uses: rossjrw/pr-preview-action@v1 | |
with: | |
source-dir: ${{ env.DIST_PATH }} | |
preview-branch: gh-pages | |
umbrella-dir: pr-preview | |
action: auto | |
deploy-main: | |
name: Deploy UI | |
runs-on: ubuntu-latest | |
concurrency: ui-deployment-main | |
if: github.ref == 'refs/heads/main' | |
needs: build | |
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment | |
permissions: | |
contents: write | |
pages: write # to deploy to Pages | |
id-token: write # to verify the deployment originates from an appropriate source | |
# Deploy to the github-pages environment | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: storybook-static | |
path: ${{ env.DIST_PATH }} | |
- name: Deploy on GitHub Pages | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
folder: ${{ env.DIST_PATH }} | |
clean-exclude: pr-preview | |
force: false | |
branch: gh-pages |