Reload resources in the editor when the resource changes (#5631) #6669
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
# GitHub Action to build the Storybook of the editor and publish it for testing. | |
# | |
# Note that only the Storybook is built and GDevelop.js is not rebuilt (for speed concerns), | |
# so changes in the C++ source could not be reflected if the CI run by Travis-CI | |
# did not upload a freshly built GDevelop.js. | |
name: Build Storybook | |
on: | |
# Launch on all commits. | |
push: | |
branches: | |
- "**" | |
tags-ignore: | |
- "**" # Don't run on new tags | |
# Allows to run this workflow manually from the Actions tab, | |
# to publish on Chromatic (not done by default). | |
workflow_dispatch: | |
jobs: | |
build-storybook: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 50 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: "npm" | |
cache-dependency-path: "newIDE/app/package-lock.json" | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.BUILD_STORYBOOK_AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.BUILD_STORYBOOK_AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- name: Install newIDE dependencies | |
run: npm install | |
working-directory: newIDE/app | |
- name: Build Storybook | |
run: npm run build-storybook | |
working-directory: newIDE/app | |
# Publish on S3 to allow quick testing of components. | |
- name: Publish Storybook to S3 bucket (specific commit) | |
run: aws s3 sync ./build-storybook/ s3://gdevelop-storybook/$(git rev-parse --abbrev-ref HEAD)/commit/$(git rev-parse HEAD)/ --delete | |
working-directory: newIDE/app | |
- name: Publish Storybook to S3 bucket (latest) | |
run: aws s3 sync ./build-storybook/ s3://gdevelop-storybook/$(git rev-parse --abbrev-ref HEAD)/latest/ --delete | |
working-directory: newIDE/app | |
- name: Log urls to the Storybook | |
run: | | |
echo "Find the latest Storybook for this branch on https://gdevelop-storybook.s3.amazonaws.com/$(git rev-parse --abbrev-ref HEAD)/latest/index.html" | |
echo "Find the Storybook for this commit on https://gdevelop-storybook.s3.amazonaws.com/$(git rev-parse --abbrev-ref HEAD)/commit/$(git rev-parse HEAD)/index.html" | |
# Publish on Chromatic, only when manually launched (too costly to run on every commit). | |
- name: Publish Storybook to Chromatic | |
if: github.event_name == 'workflow_dispatch' | |
uses: chromaui/action@v1 | |
with: | |
workingDir: newIDE/app | |
storybookBuildDir: "build-storybook" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} |