Skip to content

Commit

Permalink
pages: upload to preview bucket (#510)
Browse files Browse the repository at this point in the history
* pages: upload to preview bucket

* try the preview status

* try with checks-action

* try with status permission
  • Loading branch information
james-rms authored Aug 2, 2022
1 parent 00187db commit 38f85ab
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ jobs:
- pages-swift
permissions:
contents: write
statuses: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -161,3 +162,32 @@ jobs:
git commit -m "Update docs from $GITHUB_REF_NAME (${GITHUB_SHA::7})"
git push origin gh-pages
fi
- name: "Preview: copy to staging dir"
if: "!github.event.pull_request.head.repo.fork && github.ref != 'refs/heads/main'"
run: cp -r . /tmp/preview-files && rm -rf /tmp/preview-files/.git

- name: "Preview: auth to GCS"
if: "!github.event.pull_request.head.repo.fork && github.ref != 'refs/heads/main'"
uses: "google-github-actions/auth@v0"
with:
credentials_json: "${{ secrets.GCS_PREVIEW_KEY_JSON }}"

- name: "Preview: push to preview bucket"
if: "!github.event.pull_request.head.repo.fork && github.ref != 'refs/heads/main'"
uses: "google-github-actions/upload-cloud-storage@v0"
with:
path: "/tmp/preview-files"
parent: false
destination: "foxglove-mcap-dev-preview/${{ github.ref }}"

- name: "Preview: display URL"
if: "!github.event.pull_request.head.repo.fork && github.ref != 'refs/heads/main'"
uses: Sibz/github-status-action@v1
with:
authToken: ${{secrets.GITHUB_TOKEN}}
context: "Pages Preview"
description: "Available in details"
state: "success"
sha: ${{github.event.pull_request.head.sha || github.sha}}
target_url: "https://storage.googleapis.com/foxglove-mcap-dev-preview/${{ github.ref }}/index.html"

0 comments on commit 38f85ab

Please sign in to comment.