Skip to content

Commit

Permalink
ci: rewrite workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
yousinix committed Aug 7, 2024
1 parent 1bcb52d commit 7a7d836
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 178 deletions.
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.

0 comments on commit 7a7d836

Please sign in to comment.