-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refact: extract pull-request/build-react into a reusable workflow
- Loading branch information
Showing
2 changed files
with
61 additions
and
50 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
on: | ||
workflow_call: | ||
# inputs: | ||
# config-path: | ||
# required: true | ||
# type: string | ||
|
||
jobs: | ||
build_react: | ||
name: Build React App | ||
runs-on: ubuntu-22.04 | ||
- uses: actions/checkout@v2 | ||
- name: Cache build assets | ||
id: cache-react-build-assets | ||
uses: actions/cache@v3 | ||
with: | ||
path: ./${{ env.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 }} | ||
- uses: actions/setup-node@v2 | ||
if: steps.cache-react-build-assets.outputs.cache-hit != 'true' | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
cache: "pnpm" | ||
cache-dependency-path: "**/pnpm-lock.yaml" | ||
- run: pnpm distribute ../${{ env.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 }} | ||
- 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_FEEDBACK_FISH_ID: 65f02de00b90d1 | ||
REACT_APP_HASURA_URL: https://hasura.${{ env.FULL_DOMAIN }}/v1/graphql | ||
REACT_APP_SHAREDB_URL: wss://sharedb.${{ env.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 }} | ||
- run: pnpm build-storybook | ||
if: steps.cache-react-build-assets.outputs.cache-hit != 'true' | ||
working-directory: ${{ env.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_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_GOOGLE_OAUTH_OVERRIDE: https://api.editor.planx.dev | ||
REACT_APP_ENV: pizza |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -172,60 +172,11 @@ jobs: | |
working-directory: ${{ env.EDITOR_DIRECTORY }} | ||
|
||
build_react_app: | ||
uses: ./.github/workflows/build_react.yml | ||
name: Build React App | ||
runs-on: ubuntu-22.04 | ||
needs: [changes] | ||
if: "${{ !contains(needs.changes.outputs.commit, '[skip pizza]') }}" | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Cache build assets | ||
id: cache-react-build-assets | ||
uses: actions/cache@v3 | ||
with: | ||
path: ./${{ env.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 }} | ||
- uses: actions/setup-node@v2 | ||
if: steps.cache-react-build-assets.outputs.cache-hit != 'true' | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
cache: "pnpm" | ||
cache-dependency-path: "**/pnpm-lock.yaml" | ||
- run: pnpm distribute ../${{ env.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 }} | ||
- 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_FEEDBACK_FISH_ID: 65f02de00b90d1 | ||
REACT_APP_HASURA_URL: https://hasura.${{ env.FULL_DOMAIN }}/v1/graphql | ||
REACT_APP_SHAREDB_URL: wss://sharedb.${{ env.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 }} | ||
- run: pnpm build-storybook | ||
if: steps.cache-react-build-assets.outputs.cache-hit != 'true' | ||
working-directory: ${{ env.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_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_GOOGLE_OAUTH_OVERRIDE: https://api.editor.planx.dev | ||
REACT_APP_ENV: pizza | ||
|
||
pulumi_preview: | ||
name: Run Pulumi Preview | ||
|