Skip to content

Specify bucket-path when github.head_ref is not set #160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions .github/actions/build-and-deploy-to-bucket/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,15 @@ inputs:
description: JSON key for Google Cloud Platform service account.
required: true
gcpBucketName:
description: The name of the bucket where code wil be deployed.
description: The name of the bucket where the code will be deployed.
required: true
gcpBucketPath:
description: >
The path where in the bucket the code will be deployed. When you don't to
put the code in the bucket's subfolder, set `.`. Otherwise provide the
path, without leading `./` (for example `subfolder_1/subfolder_2`).
required: false
default: .
preview:
description: True if the code should be pushed to the preview bucket.
required: true
Expand Down Expand Up @@ -106,13 +113,21 @@ runs:
environment: ${{ inputs.environment }}

- name: Build
if: inputs.gcpBucketPath == '.'
shell: bash
run: yarn build
env:
PUBLIC_URL: /
CHAIN_ID: ${{ env.NETWORK_ID }}
ETH_HOSTNAME_HTTP: ${{ inputs.ethUrlHttp }}
ETH_HOSTNAME_WS: ${{ inputs.ethUrlWS }}

- name: Build
if: inputs.gcpBucketPath != '.'
shell: bash
run: yarn build
env:
# `head_ref` variable property is only available when the event that
# triggers a workflow run is either pull_request or pull_request_target.
# For `workflow_dispatch` and `push`, the `PUBLIC_URL` will resolve to `/`.`
PUBLIC_URL: /${{ github.head_ref }}
PUBLIC_URL: /${{ inputs.gcpBucketPath }}
CHAIN_ID: ${{ env.NETWORK_ID }}
ETH_HOSTNAME_HTTP: ${{ inputs.ethUrlHttp }}
ETH_HOSTNAME_WS: ${{ inputs.ethUrlWS }}
Expand All @@ -123,7 +138,7 @@ runs:
service-key: ${{ inputs.gcpServiceKey }}
project: ${{ env.GOOGLE_PROJECT_ID }}
bucket-name: ${{ inputs.gcpBucketName }}
bucket-path: ${{ github.head_ref }}
bucket-path: ${{ inputs.gcpBucketPath }}
build-folder: build
set-website: ${{ inputs.preview == 'false' }}
home-page-path: index.html
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/dashboard-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ jobs:
dependentPackagesTag: goerli
gcpServiceKey: ${{ secrets.KEEP_TEST_CI_UPLOAD_DAPP_JSON_KEY_BASE64 }}
gcpBucketName: preview.dashboard.test.threshold.network
gcpBucketPath: ${{ github.head_ref }}
preview: true

# This job will be triggered via the `workflow_dispatch` event, as part of the
Expand Down