name: Build preview release
on: workflow_dispatch
env:
  NODE_VERSION: 18
  PAGES_REPO_URL: git@github.com:6502ts/6502ts.github.io.git
jobs:
  build_and_release:
    runs-on: ubuntu-20.04
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Setup node
        uses: actions/setup-node@v2
        with:
          node-version: ${{env.NODE_VERSION}}
      - name: Install deps
        run: yarn install
      - name: Build
        run: yarn build
      - name: Setup SSH agent
        uses: webfactory/ssh-agent@v0.5.1
        with:
            ssh-private-key: ${{ secrets.SSH_DEPLOY_KEY }}
      - name: Checkout pages source
        run: git clone --depth 1 ${{env.PAGES_REPO_URL}}
      - name: Copy and deploy
        working-directory: 6502ts.github.io
        run: |
          test -x preview && rm -fr preview
          mkdir preview
          cp -r ../dist/stellerator-embedded ../dist/stellerator-ng ../dist/typedoc ./preview
          git add .
          git config --global user.email "golem@nowhere.org"
          git config --global user.name "The Golem"
          git commit -m "Bump dev build."
          git push

name: Build preview release
on: workflow_dispatch
env:
  NODE_VERSION: 18
  PAGES_REPO_URL: git@github.com:6502ts/6502ts.github.io.git
jobs:
  build_and_release:
    runs-on: ubuntu-20.04
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Setup node
        uses: actions/setup-node@v2
        with:
          node-version: ${{env.NODE_VERSION}}
      - name: Install deps
        run: yarn install
      - name: Build
        run: PREVIEW=1 yarn build
      - name: Setup SSH agent
        uses: webfactory/ssh-agent@v0.5.1
        with:
            ssh-private-key: ${{ secrets.SSH_DEPLOY_KEY }}
      - name: Checkout pages source
        run: git clone --depth 1 ${{env.PAGES_REPO_URL}}
      - name: Copy and deploy
        working-directory: 6502ts.github.io
        run: |
          test -x preview && rm -fr preview
          mkdir preview
          cp -r ../dist/stellerator-embedded ../dist/stellerator-ng ../dist/typedoc ./preview
          git add .
          git config --global user.email "golem@nowhere.org"
          git config --global user.name "The Golem"
          git commit -m "Bump dev build."
          git push

Switch preview build to preview DB.
Switch preview build to preview DB.
