Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: rewrite workflows #29

Merged
merged 1 commit into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/actions/bootstrap/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Bootstrap
description: Bootstrap the app and Widgetbook, then build Widgetbook

runs:
using: composite
steps:
- name: Setup flutter
uses: subosito/flutter-action@v2
with:
channel: stable

- name: Bootstrap App
shell: bash
run: |
flutter pub get
flutter gen-l10n

- name: Bootstrap Widgetbook
working-directory: widgetbook
shell: bash
run: |
flutter pub get
dart run build_runner build -d

- name: Build Widgetbook
working-directory: widgetbook
shell: bash
run: flutter build web
32 changes: 32 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Deploy Demo

on:
push:
branches:
- main

jobs:
deploy:
# Only run it if the service account is set,
# to avoid running it on internal forks (e.g. e2e)
if: ${{ secrets.STORAGE_SERVICE_ACCOUNT != '' }}
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Bootstrap
uses: ./.github/actions/bootstrap

- name: Authenticate Service Account
uses: google-github-actions/[email protected]
with:
credentials_json: ${{ secrets.STORAGE_SERVICE_ACCOUNT }}

- name: Deploy to demo.widgetbook.io
uses: google-github-actions/[email protected]
with:
path: widgetbook/build/web
destination: demo.widgetbook.io
parent: false
38 changes: 0 additions & 38 deletions .github/workflows/widgetbook-build-staging.yaml

This file was deleted.

50 changes: 0 additions & 50 deletions .github/workflows/widgetbook-build.yaml

This file was deleted.

36 changes: 36 additions & 0 deletions .github/workflows/widgetbook-cloud.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Widgetbook Cloud

on: push

jobs:
staging:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Bootstrap
uses: ./.github/actions/bootstrap

- name: Install Widgetbook CLI
run: dart pub global activate widgetbook_cli

- name: Upload Widgetbook
working-directory: widgetbook
run: widgetbook_staging cloud build push --api-key ${{ secrets.WIDGETBOOK_CLOUD_API_KEY_STAGING }}

production:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Bootstrap
uses: ./.github/actions/bootstrap

- name: Install Widgetbook CLI
run: dart pub global activate widgetbook_cli

- name: Upload Widgetbook
working-directory: widgetbook
run: widgetbook cloud build push --api-key ${{ secrets.WIDGETBOOK_CLOUD_API_KEY }}
45 changes: 0 additions & 45 deletions .github/workflows/widgetbook-review-staging.yaml

This file was deleted.

45 changes: 0 additions & 45 deletions .github/workflows/widgetbook-review.yaml

This file was deleted.

Loading