name: Build schemarama.bundle.js
on:
  push:
    branches:
    - main

jobs:
  yarn:
    name: Build schemarama.bundle.js
    runs-on: ubuntu-latest  
    steps:
    - name: Checkout
      uses: actions/checkout@v2
    - name: Setup Node.js environment
      uses: actions/setup-node@v2.1.2
    - name: Install node_modules
      run: npm install
      working-directory: ./core
    - name: Build webpack
      run: npx webpack --config webpack.config.js
      working-directory: ./core
    - name: Archive schemarama.bundle.js
      uses: actions/upload-artifact@v1
      with:
        name: bundles
        path: core/dist/schemarama.bundle.js
    - name: Archive schemarama.bundle.min.js
      uses: actions/upload-artifact@v1
      with:
        name: bundles
        path: core/dist/schemarama.bundle.min.js
    - name: Archive schemarama-parsing.bundle.js
      uses: actions/upload-artifact@v1
      with:
        name: parsing-bundles
        path: core/dist/schemarama-parsing.bundle.js
    - name: Archive schemarama-parsing.bundle.min.js
      uses: actions/upload-artifact@v1
      with:
        name: parsing-bundles
        path: core/dist/schemarama-parsing.bundle.min.js

name: Build bundles
on:
  push:
    branches:
    - main

jobs:
  yarn:
    name: Build bundles
    runs-on: ubuntu-latest  
    steps:
    - name: Checkout
      uses: actions/checkout@v2
    - name: Setup Node.js environment
      uses: actions/setup-node@v2.1.2
    - name: Install node_modules
      run: npm install
      working-directory: ./core
    - name: Build webpack
      run: npx webpack --config webpack.config.js
      working-directory: ./core
    - name: Push to built branch
      uses: Automattic/action-commit-to-branch@master
      with:
        branch: 'main'
        commit_message: 'Add bundles'
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Required

Test automatic commit & push
Test automatic commit & push
