env:
  RUBY_VERSION: 2.7.2


name: Build Release
on:
  release:
    types: [released]

jobs:
  main:
    name: Build Docker Image
    runs-on: ubuntu-18.04
    steps:
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v1
        
      - name: Login to Github Container Registry
        uses: docker/login-action@v1
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_PASSWORD }}

      - name: Build and Push release
        uses: docker/build-push-action@v2
        with:
          push: true
          tags: |
            bigbluebutton/greenlight:latest
            bigbluebutton/greenlight:v2
            bigbluebutton/greenlight:${{ github.event.release.tag_name }}
          build-args: version_code=${{ github.event.release.tag_name }}
