name: Release containerization

permissions:
  contents: read

on: 
  push: 
    tags:
      - "[0-9]+\\.[0-9]+\\.[0-9]+"

jobs: 
  containerization:
    uses: ./.github/workflows/containerization-build-template.yml
    with: 
      release: true
      version: ${{ github.ref_name }}
    secrets: inherit
    permissions:
      contents: read
      packages: write
      pages: write

  deployDocs:
    if: startsWith(github.ref, 'refs/tags/')
    runs-on: ubuntu-latest
    needs: containerization
    permissions:
      contents: read
      pages: write
      id-token: write
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    steps:
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e  # v4

  release: 
    if: startsWith(github.ref, 'refs/tags/')
    name: Publish release
    timeout-minutes: 30
    needs: containerization
    runs-on: ubuntu-latest
    permissions:
      contents: write
      packages: read
    steps:
      - name: Create release
        uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65  # v2
        with:
          token: ${{ github.token }}
          name: ${{ github.ref_name }}-prerelease
          draft: true
          make_latest: false
          prerelease: true
          fail_on_unmatched_files: true
