From 8ab9319291b052f404b9cfc77bf22f2f044307be Mon Sep 17 00:00:00 2001 From: Kevin Schaul Date: Wed, 5 Jun 2024 10:43:37 -0500 Subject: [PATCH] Set up .env file --- .env | 10 ++++++++++ .github/workflows/deploy.yml | 36 ++++++++++++++++++------------------ README.md | 6 +++--- jump-start-gallery | 2 +- package.json | 2 +- 5 files changed, 33 insertions(+), 23 deletions(-) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 index 0000000..13bdc32 --- /dev/null +++ b/.env @@ -0,0 +1,10 @@ +# Set one of these to true, depending on whether you want the custom site or +# the storybook as your jump-start frontend +DEPLOY_CUSTOM_SITE=true +DEPLOY_STORYBOOK=false + +# GITHUB_USERNAME= +# GITHUB_REPO= + +# Set this to tar (default) or git (slower, but works with private repos) +DEGIT_MODE=tar diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 84cae35..93bc9e3 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,11 +1,5 @@ name: Deploy to Pages -env: - # Set one of these to true, depending on whether you want the custom site or - # the storybook as your jump-start frontend - DEPLOY_CUSTOM_SITE: true - DEPLOY_STORYBOOK: false - on: # Runs on pushes targeting the default branch push: @@ -32,12 +26,18 @@ jobs: runs-on: ubuntu-latest if: ${{ github.repository != 'kevinschaul/jump-start-template' }} env: - JUMP_START_GITHUB_USERNAME: ${{ github.repository_owner }} - JUMP_START_GITHUB_REPO: ${{ github.event.repository.name }} + GITHUB_USERNAME: ${{ github.repository_owner }} + GITHUB_REPO: ${{ github.event.repository.name }} steps: - name: Checkout uses: actions/checkout@v4 + - name: Dotenv + id: dotenv + uses: falti/dotenv-action@v1.1.2 + with: + keys-case: bypass + - name: Setup Node uses: actions/setup-node@v4 with: @@ -66,13 +66,13 @@ jobs: git push - name: Set up Python - if: ${{ env.DEPLOY_CUSTOM_SITE == 'true' }} + if: ${{ steps.dotenv.outputs.DEPLOY_CUSTOM_SITE == 'true' }} uses: actions/setup-python@v5 with: python-version: '3.10' - uses: actions/cache@v4 - if: ${{ env.DEPLOY_CUSTOM_SITE == 'true' }} + if: ${{ steps.dotenv.outputs.DEPLOY_CUSTOM_SITE == 'true' }} name: Configure pip caching with: path: ~/.cache/pip @@ -81,24 +81,24 @@ jobs: ${{ runner.os }}-pip- - name: Cache Playwright browsers - if: ${{ env.DEPLOY_CUSTOM_SITE == 'true' }} + if: ${{ steps.dotenv.outputs.DEPLOY_CUSTOM_SITE == 'true' }} uses: actions/cache@v4 with: path: ~/.cache/ms-playwright/ key: ${{ runner.os }}-browsers - name: Install Python dependencies - if: ${{ env.DEPLOY_CUSTOM_SITE == 'true' }} + if: ${{ steps.dotenv.outputs.DEPLOY_CUSTOM_SITE == 'true' }} run: | pip install -r jump-start-gallery/requirements.txt - name: Install Playwright dependencies - if: ${{ env.DEPLOY_CUSTOM_SITE == 'true' }} + if: ${{ steps.dotenv.outputs.DEPLOY_CUSTOM_SITE == 'true' }} run: | shot-scraper install - name: Start server and take screenshots - if: ${{ env.DEPLOY_CUSTOM_SITE == 'true' }} + if: ${{ steps.dotenv.outputs.DEPLOY_CUSTOM_SITE == 'true' }} run: | mkdir -p jump-start-gallery/public/screenshots && npm run dev & @@ -106,25 +106,25 @@ jobs: npm run update-screenshots - name: Build custom site - if: ${{ env.DEPLOY_CUSTOM_SITE == 'true' }} + if: ${{ steps.dotenv.outputs.DEPLOY_CUSTOM_SITE == 'true' }} env: GITHUB_PAGES_BASE_PATH: ${{ steps.pages.outputs.base_path }} run: npm run build - name: Upload custom site artifact - if: ${{ env.DEPLOY_CUSTOM_SITE == 'true' }} + if: ${{ steps.dotenv.outputs.DEPLOY_CUSTOM_SITE == 'true' }} uses: actions/upload-pages-artifact@v3 with: path: ./jump-start-gallery/dist - name: Build storybook - if: ${{ env.DEPLOY_STORYBOOK == 'true' }} + if: ${{ steps.dotenv.outputs.DEPLOY_STORYBOOK == 'true' }} env: GITHUB_PAGES_BASE_PATH: ${{ steps.pages.outputs.base_path }} run: npm run build-storybook - name: Upload custom site artifact - if: ${{ env.DEPLOY_STORYBOOK == 'true' }} + if: ${{ steps.dotenv.outputs.DEPLOY_STORYBOOK == 'true' }} uses: actions/upload-pages-artifact@v3 with: path: ./jump-start-gallery/storybook-static diff --git a/README.md b/README.md index feaefce..f876367 100644 --- a/README.md +++ b/README.md @@ -94,9 +94,9 @@ Open localhost:6006 in a browser. ## Deploying the gallery to Github Pages This repo includes a [deploy workflow](.github/workflows/deploy.yml) that -deploys your jump start gallery to Github pages. By default the custom gallery -frontend is used, but you can edit the env variables at the top of the workflow -file to deploy the Storybook version instead. +deploys your jump start gallery to Github pages. By default the custom +gallery frontend is used, but you can edit the env variables in +[.env](.env) to deploy the Storybook version instead. ## Updating the gallery code diff --git a/jump-start-gallery b/jump-start-gallery index d873c45..1d52379 160000 --- a/jump-start-gallery +++ b/jump-start-gallery @@ -1 +1 @@ -Subproject commit d873c455dc037c343a20f1bfa4e273ea7a33d934 +Subproject commit 1d5237951ddaa87b3e4bd7fb15c1038034b0cd25 diff --git a/package.json b/package.json index 714eab2..27f63d9 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "gallery:clone": "git submodule update --init", "gallery:update": "git submodule sync --recursive", "gallery:install": "cd jump-start-gallery && npm install", - "gallery:link": "cd jump-start-gallery && rm -f src/starters && ln -sf ../../ src/starters" + "gallery:link": "cd jump-start-gallery && rm -f src/starters && ln -sf ../../ src/starters && rm -rf .env && ln -sf ../.env .env" }, "repository": { "type": "git",