mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
72 lines
2.8 KiB
YAML
72 lines
2.8 KiB
YAML
# 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:
|
|
# 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:
|
|
- name: Configure AWS Credentials
|
|
uses: aws-actions/configure-aws-credentials@v1
|
|
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
|
|
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 50
|
|
|
|
# Cache npm dependencies to speed up the workflow
|
|
- name: Cache node modules
|
|
uses: actions/cache@v2
|
|
env:
|
|
cache-name: cache-newIDE-app-node_modules
|
|
with:
|
|
# npm cache files are stored in `~/.npm` on Linux/macOS
|
|
path: ~/.npm
|
|
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('newIDE/app/package-lock.json') }}
|
|
|
|
- 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 http://gdevelop-storybook.s3-website-us-east-1.amazonaws.com/$(git rev-parse --abbrev-ref HEAD)/latest/index.html"
|
|
echo "Find the Storybook for this commit on http://gdevelop-storybook.s3-website-us-east-1.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 }}
|