name: CD | Gihub page | PWA Microservices Template

on:
  push:
    branches: ['main']

  workflow_dispatch:

permissions:
  contents: read
  pages: write
  id-token: write

concurrency:
  group: 'pages'
  cancel-in-progress: false

jobs:
  deploy:
    if: github.repository == 'underpostnet/pwa-microservices-template-ghpkg'
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    runs-on: ubuntu-latest
    container:
      image: quay.io/rockylinux/rockylinux:9
    steps:
      - name: Checkout
        uses: actions/checkout@v7
        # with:
        #   lfs: true
      # - name: Checkout LFS objects
      #   run: git lfs checkout

      - name: Build the site
        run: bash deploy/pwa-microservices-template/deploy.sh
      # git lfs install
      # git lfs track
      # git lfs ls-files
      # git lfs pull
      - name: Setup Pages
        uses: actions/configure-pages@v6
      - name: Upload artifact
        uses: actions/upload-pages-artifact@v5
        with:
          # Upload entire repository
          path: './public/underpostnet.github.io/pwa-microservices-template-ghpkg/'
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v5
