epaew/react-liff

View on GitHub
.github/workflows/deploy-example.yaml

Summary

Maintainability
Test Coverage
name: Deploy example app to gh-pages

on:
  # pull_request: {}
  push:
    branches:
      - master
  workflow_dispatch: {}

jobs:
  build:
    name: Build react-liff
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 'lts/*'
          cache: npm

      - run: npm ci
      - run: npm run build
      - name: Upload the result of build react-liff
        uses: actions/upload-artifact@v3
        with:
          name: dist
          path: dist

  build-example-app:
    name: Build example app
    runs-on: ubuntu-latest
    needs:
      - build
    defaults:
      run:
        working-directory: examples/simple
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 'lts/*'
          cache: npm
      - name: Download the result of build react-liff
        uses: actions/download-artifact@v3
        with:
          name: dist
          path: dist

      - run: npm i
      - run: npm run build
        env:
          REACT_APP_LINE_LIFF_ID: ${{ secrets.LINE_LIFF_ID }}
          NODE_ENV: production
          PUBLIC_URL: /react-liff
      - name: Upload the result of build react-liff
        uses: actions/upload-artifact@v3
        with:
          name: build
          path: examples/simple/build

  deploy:
    name: Deploy to gh-pages
    runs-on: ubuntu-latest
    needs:
      - build-example-app
    steps:
      - name: Download the result of build react-liff
        uses: actions/download-artifact@v3
        with:
          name: build
          path: examples/simple/build
      - name: Deploy to gh-pages
        uses: peaceiris/actions-gh-pages@v3
        with:
          cname: www.epaew.net
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_branch: gh-pages
          publish_dir: ./examples/simple/build