Skip to content

Commit

Permalink
Fix bucket name passing (#11)
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Rockwood <benr@cuddletech.com>
  • Loading branch information
benr authored Mar 1, 2024
1 parent 70f6394 commit 5734c14
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 5 deletions.
16 changes: 15 additions & 1 deletion .github/workflows/PREview-create.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,31 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
allow-repeats: true

data:
runs-on: ubuntu-latest
outputs:
URL: ${{ steps.data.outputs.URL }}
BUCKET: ${{ steps.data.outputs.BUCKET }}
BRANCH: ${{ steps.data.outputs.BRANCH }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Obtain URL
id: data
uses: ./.github/actions/PREview-data

build:
uses: ./.github/workflows/_build.yaml
with:
output_dir: build
secrets: inherit

deploy-update:
needs: [build]
needs: [data, build]
uses: ./.github/workflows/_deploy.yaml
with:
src_dir: build
bucket: ${{ needs.data.outputs.BUCKET }}
secrets: inherit

notify:
Expand Down
16 changes: 15 additions & 1 deletion .github/workflows/PREview-update.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,31 @@ on:
types: [synchronize]

jobs:
data:
runs-on: ubuntu-latest
outputs:
URL: ${{ steps.data.outputs.URL }}
BUCKET: ${{ steps.data.outputs.BUCKET }}
BRANCH: ${{ steps.data.outputs.BRANCH }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Obtain URL
id: data
uses: ./.github/actions/PREview-data

build:
uses: ./.github/workflows/_build.yaml
with:
output_dir: build
secrets: inherit

deploy-update:
needs: [build]
needs: [data, build]
uses: ./.github/workflows/_deploy.yaml
with:
src_dir: build
bucket: ${{ needs.data.outputs.BUCKET }}
secrets: inherit

notify:
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/_deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
default: "build"
required: false
type: string
bucket:
description: "The GCS bucket to deploy to"
required: true
type: string

jobs:
deploy:
Expand All @@ -26,7 +30,5 @@ jobs:
credentials_json: "${{ secrets.GCP_SERVICE_ACCOUNT }}"
- name: "Set up Cloud SDK"
uses: "google-github-actions/setup-gcloud@v2"
- name: Obtain Bucket Name
uses: ./.github/actions/PREview-data
- name: Upload static content to buckets
run: gsutil -m -h "Cache-control:public, max-age=60" rsync -r -c -C -d ${{ inputs.src_dir }}/ gs://${BUCKET}
run: gsutil -m -h "Cache-control:public, max-age=60" rsync -r -c -C -d ${{ inputs.src_dir }}/ gs://${{ inputs.bucket }}

0 comments on commit 5734c14

Please sign in to comment.