dffae66fdc
* add first attempt at storybook deploy action for canary * don't run on push to main yet! * add CODEOWNER
80 lines
2.2 KiB
YAML
80 lines
2.2 KiB
YAML
name: Deploy Storybook
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
# push:
|
|
# branches:
|
|
# - main
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
permissions: {}
|
|
|
|
jobs:
|
|
detect-changes:
|
|
# Only run in grafana/grafana
|
|
if: github.repository == 'grafana/grafana'
|
|
name: Detect whether code changed
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
outputs:
|
|
changed-frontend-packages: ${{ steps.detect-changes.outputs.frontend-packages }}
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
persist-credentials: true # required to get more history in the changed-files action
|
|
fetch-depth: 2
|
|
- name: Detect changes
|
|
id: detect-changes
|
|
uses: ./.github/actions/change-detection
|
|
with:
|
|
self: .github/workflows/deploy-storybook.yml
|
|
deploy-storybook:
|
|
name: Deploy Storybook
|
|
runs-on: ubuntu-latest
|
|
needs: detect-changes
|
|
# Only run in grafana/grafana
|
|
if: github.repository == 'grafana/grafana' && needs.detect-changes.outputs.changed-frontend-packages == 'true'
|
|
permissions:
|
|
contents: read
|
|
id-token: write
|
|
|
|
env:
|
|
BUCKET_NAME: grafana-storybook
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v5
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Setup Node.js
|
|
uses: ./.github/actions/setup-node
|
|
|
|
- name: Install dependencies
|
|
run: yarn install --immutable
|
|
|
|
- name: Build storybook
|
|
run: yarn storybook:build
|
|
|
|
# Create the GCS folder name
|
|
# Right now, this just returns "canary"
|
|
# But we'll expand this to work for "latest" as well in the future
|
|
- name: Create deploy name
|
|
id: create-deploy-name
|
|
run: |
|
|
echo "deploy-name=canary" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Upload Storybook
|
|
uses: grafana/shared-workflows/actions/push-to-gcs@main
|
|
with:
|
|
environment: prod
|
|
bucket: ${{ env.BUCKET_NAME }}
|
|
bucket_path: ${{ steps.create-deploy-name.outputs.deploy-name }}
|
|
path: packages/grafana-ui/dist/storybook
|
|
service_account: github-gf-storybook-deploy@grafanalabs-workload-identity.iam.gserviceaccount.com
|
|
parent: false
|