name: Create and publish Docker images

on:
  # push:
  #   branches: ['develop']
  workflow_dispatch:

jobs:
  create-and-publish-dev-image:
    name: Create and publish dev image
    # if: github.ref == 'refs/heads/develop'
    runs-on: ubuntu-20.04
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2
        # ref: develop

      - name: Start system
        run: ./dev start

      - name: Create production static files
        run: ./dev static_prod

      # - name: Migrate database
      #   run: ./dev migrate

      # - name: Load resources
      #   run: ./dev ???

      - name: Collect staticfiles
        run: ./dev collect_static

      - name: Log in to the Container registry
        uses: docker/login-action@v1.10.0
        with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}

      - name: Build and push Docker image
        uses: docker/build-push-action@v2.6.1
        with:
          context: .
          push: true
          tags: uccser/cs-unplugged:develop

name: Create and publish Docker images

on:
  workflow_dispatch:
  push:
    branches: ['develop', 'server-migration']

jobs:
  create-and-publish-dev-image:
    name: Create and publish dev image
    # if: github.ref == 'refs/heads/develop'
    runs-on: ubuntu-20.04
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2
        # ref: develop

      - name: Start system
        run: ./dev start

      - name: Create production static files
        run: ./dev static_prod

      # - name: Migrate database
      #   run: ./dev migrate

      # - name: Load resources
      #   run: ./dev ???

      - name: Collect staticfiles
        run: ./dev collect_static

      - name: Log in to the Container registry
        uses: docker/login-action@v1.10.0
        with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}

      - name: Build and push Docker image
        uses: docker/build-push-action@v2.6.1
        with:
          context: .
          push: true
          tags: uccser/cs-unplugged:develop

Add branch name to job
Add branch name to job
