GitHub Actions

It's possible to export and deploy static pages via GitHub Actions. Below is an example workflow file which deploys to Netlify. This workflow requires two GitHub Action Secrets you should add to your repository (NETLIFY_AUTH_TOKEN, NETLIFY_SITE_ID) more details in the netlify/actions repo.

.github/workflows/deploy.yml
name: Deploy

on:
  push:
    branches:
      - master

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Git checkout
        uses: actions/checkout@v1
      - name: Copy .env
        run: php -r "file_exists('.env') || copy('.env.example', '.env');"
      - name: Install Composer Dependencies
        run: composer install --no-ansi --no-interaction --no-suggest --no-progress --prefer-dist
      - name: Install Yarn Dependencies
        run: yarn install
      - name: Generate key
        run: php artisan key:generate
      - name: Mix assets
        run: yarn production
      - name: Export page
        run: php artisan export --env=prod --skip-assets --skip-deploy
      - name: Netlify deploy
        uses: netlify/actions/cli@master
        with:
          args: deploy --prod
        env:
          NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
          NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}

You should adjust it to your needs if you require any custom commands to be able to export your page.

Last updated