Release Demo #52
This file contains hidden or 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: Release Demo | |
# Job will only run on push to the main branch after the release library job have passed | |
on: | |
workflow_run: | |
workflows: ['Release Library'] | |
types: [completed] | |
workflow_dispatch: | |
inputs: {} | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
concurrency: | |
group: 'pages' | |
cancel-in-progress: false | |
env: | |
ARTIFACT_NAME: 'build-demo-artifact' | |
jobs: | |
build: | |
if: | | |
github.ref == 'refs/heads/main' && | |
github.event.repository.fork == false && | |
github.actor != 'dependabot[bot]' | |
runs-on: ubuntu-latest | |
timeout-minutes: 1 | |
environment: | |
name: github-pages | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Bun - Version ${{ vars.BUN_VERSION }} | |
uses: oven-sh/setup-bun@v2 | |
with: | |
bun-version: ${{ vars.BUN_VERSION }} | |
- name: Install dependencies | |
run: bun install | |
- name: Build project | |
env: | |
NODE_ENV: ${{ secrets.NODE_ENV }} | |
HOST_URL: ${{ secrets.HOST_URL }} | |
run: | | |
bun run build:demo | |
bun run postBuild:demo | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.ARTIFACT_NAME }} | |
path: ${{ vars.DEMO_PATH }} | |
if-no-files-found: error | |
release: | |
runs-on: ubuntu-latest | |
needs: [ build ] | |
timeout-minutes: 1 | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Download build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ env.ARTIFACT_NAME }} | |
path: ${{ vars.DEMO_PATH }} | |
# - name: Deploy to gh-pages branch | |
# uses: peaceiris/actions-gh-pages@v4 | |
# with: | |
# github_token: ${{ secrets.GITHUB_TOKEN }} | |
# publish_dir: ${{ vars.DEMO_PATH }} | |
# publish_branch: gh-pages | |
# force_orphan: true | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
- name: Upload artifact to Pages | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ${{ vars.DEMO_PATH }} | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |