GitHub Actions
Deploy to Sandbar from GitHub Actions.
Production deploy on push to main
Section titled “Production deploy on push to main”name: Deploy to Sandbaron: push: branches: [main]
jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 22 - run: npm ci - run: npm run build - name: Install Sandbar CLI run: curl -sSL https://sandbar.cloud/install.sh | sh - name: Deploy run: sandbar deploy --dir dist env: SANDBAR_API_KEY: ${{ secrets.SANDBAR_API_KEY }}Preview on pull request
Section titled “Preview on pull request”name: Previewon: pull_request: types: [opened, synchronize]
jobs: preview: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 22 - run: npm ci - run: npm run build - name: Install Sandbar CLI run: curl -sSL https://sandbar.cloud/install.sh | sh - name: Deploy Preview run: sandbar preview --label "pr-${{ github.event.pull_request.number }}" env: SANDBAR_API_KEY: ${{ secrets.SANDBAR_API_KEY }}