Blog>
Snippets

Automating Deployment with GitHub Actions and TanStack Config

Provide an example of a GitHub Actions workflow that automates the deployment of a JavaScript application configured with TanStack Config.
name: Publish and Deploy

on:
  push:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Setup Node.js
        uses: actions/setup-node@v1
        with:
          node-version: '14'
      - name: Install Dependencies
        run: npm install
      - name: Run TanStack Config Build
        run: npm run build
      - name: Deploy to GitHub Pages
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./build
This workflow is triggered on a push to the main branch. It sets up a Node.js environment, installs dependencies, and runs the TanStack Config build process with 'npm run build'. Finally, it deploys the build directory to GitHub Pages using the GitHub token for authentication.