on:
  workflow_dispatch:
  push:
    branches:
      - devel

name: Create Packages (deb)

jobs:
  build:
    name: "build"
    runs-on: ubuntu-26.04
    if: (github.repository_owner == 'dosemu2')
    steps:
    - uses: actions/checkout@v6
    - name: Set up Docker Buildx
      uses: docker/setup-buildx-action@v3
    - name: Build
      uses: docker/build-push-action@v6
      with:
        context: .
        file: ./Dockerfile.debian
        push: false
        load: false
        outputs: type=local,dest=deb
        tags: dosemu2-debian:latest
    - uses: actions/checkout@v6
      with:
        ref: gh-pages
        clean: false
    - name: Index
      run: |
        mkdir pub
        tar zcvf pub/debs.tar.gz deb/*
        cp -r images index.html javascripts params.json stylesheets pub

    - name: Upload
      uses: actions/upload-pages-artifact@v3
      with:
        path: pub

  deploy:
    needs: build

    permissions:
      pages: write      # to deploy to Pages
      id-token: write   # to verify the deployment originates from an appropriate source

    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}

    runs-on: ubuntu-26.04
    steps:
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v5
