Skip to content

Commit

Permalink
fix(ci): env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
gunar committed Feb 23, 2023
1 parent 886201f commit a84e16e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 18 deletions.
43 changes: 26 additions & 17 deletions .github/workflows/build-react.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
on:
workflow_call:
# inputs:
# config-path:
# required: true
# type: string
inputs:
PNPM_VERSION:
required: true
type: string
EDITOR_DIRECTORY:
required: true
type: string
NODE_VERSION:
required: true
type: string
FULL_DOMAIN:
required: true
type: string

jobs:
build_react:
Expand All @@ -15,47 +24,47 @@ jobs:
id: cache-react-build-assets
uses: actions/cache@v3
with:
path: ./${{ env.EDITOR_DIRECTORY }}/build
path: ./${{ inputs.EDITOR_DIRECTORY }}/build
key: ${{ runner.os }}-${{ hashFiles('editor.planx.uk/**') }}
- uses: pnpm/[email protected]
if: steps.cache-react-build-assets.outputs.cache-hit != 'true'
with:
version: ${{ env.PNPM_VERSION }}
version: ${{ inputs.PNPM_VERSION }}
- uses: actions/setup-node@v2
if: steps.cache-react-build-assets.outputs.cache-hit != 'true'
with:
node-version: ${{ env.NODE_VERSION }}
node-version: ${{ inputs.NODE_VERSION }}
cache: "pnpm"
cache-dependency-path: "**/pnpm-lock.yaml"
- run: pnpm distribute ../${{ env.EDITOR_DIRECTORY }}
- run: pnpm distribute ../${{ inputs.EDITOR_DIRECTORY }}
if: steps.cache-react-build-assets.outputs.cache-hit != 'true'
working-directory: core
- run: pnpm install --frozen-lockfile
if: steps.cache-react-build-assets.outputs.cache-hit != 'true'
working-directory: ${{ env.EDITOR_DIRECTORY }}
working-directory: ${{ inputs.EDITOR_DIRECTORY }}
- run: pnpm build
if: steps.cache-react-build-assets.outputs.cache-hit != 'true'
env:
REACT_APP_AIRBRAKE_PROJECT_ID: ${{ secrets.AIRBRAKE_PROJECT_ID }}
REACT_APP_AIRBRAKE_PROJECT_KEY: ${{ secrets.AIRBRAKE_PROJECT_KEY }}
REACT_APP_API_URL: https://api.${{ env.FULL_DOMAIN }}
REACT_APP_API_URL: https://api.${{ inputs.FULL_DOMAIN }}
REACT_APP_FEEDBACK_FISH_ID: 65f02de00b90d1
REACT_APP_HASURA_URL: https://hasura.${{ env.FULL_DOMAIN }}/v1/graphql
REACT_APP_SHAREDB_URL: wss://sharedb.${{ env.FULL_DOMAIN }}
REACT_APP_HASURA_URL: https://hasura.${{ inputs.FULL_DOMAIN }}/v1/graphql
REACT_APP_SHAREDB_URL: wss://sharedb.${{ inputs.FULL_DOMAIN }}
# needed because there's no API to change google's allowed OAuth URLs
REACT_APP_GOOGLE_OAUTH_OVERRIDE: https://api.editor.planx.dev
REACT_APP_ENV: pizza
working-directory: ${{ env.EDITOR_DIRECTORY }}
working-directory: ${{ inputs.EDITOR_DIRECTORY }}
- run: pnpm build-storybook
if: steps.cache-react-build-assets.outputs.cache-hit != 'true'
working-directory: ${{ env.EDITOR_DIRECTORY }}
working-directory: ${{ inputs.EDITOR_DIRECTORY }}
env:
# same env as above, if it's job.env it can't access existing env.[variable]
REACT_APP_AIRBRAKE_PROJECT_ID: ${{ secrets.AIRBRAKE_PROJECT_ID }}
REACT_APP_AIRBRAKE_PROJECT_KEY: ${{ secrets.AIRBRAKE_PROJECT_KEY }}
REACT_APP_API_URL: https://api.${{ env.FULL_DOMAIN }}
REACT_APP_API_URL: https://api.${{ inputs.FULL_DOMAIN }}
REACT_APP_FEEDBACK_FISH_ID: 65f02de00b90d1
REACT_APP_HASURA_URL: https://hasura.${{ env.FULL_DOMAIN }}/v1/graphql
REACT_APP_SHAREDB_URL: wss://sharedb.${{ env.FULL_DOMAIN }}
REACT_APP_HASURA_URL: https://hasura.${{ inputs.FULL_DOMAIN }}/v1/graphql
REACT_APP_SHAREDB_URL: wss://sharedb.${{ inputs.FULL_DOMAIN }}
REACT_APP_GOOGLE_OAUTH_OVERRIDE: https://api.editor.planx.dev
REACT_APP_ENV: pizza
7 changes: 6 additions & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,15 @@ jobs:
working-directory: ${{ env.EDITOR_DIRECTORY }}

build_react_app:
uses: ./.github/workflows/build-react.yml
name: Build React App
needs: [changes]
if: "${{ !contains(needs.changes.outputs.commit, '[skip pizza]') }}"
uses: ./.github/workflows/build-react.yml
with:
PNPM_VERSION: ${{ env.PNPM_VERSION }}
EDITOR_DIRECTORY: ${{ env.EDITOR_DIRECTORY }}
NODE_VERSION: ${{ env.NODE_VERSION }}
FULL_DOMAIN: ${{ env.FULL_DOMAIN }}

pulumi_preview:
name: Run Pulumi Preview
Expand Down

0 comments on commit a84e16e

Please sign in to comment.