# Build production image and push to Docker Hub name: Push to registry on: push: branches: - 'main' tags: - '**' jobs: push-to-registry: runs-on: ubuntu-22.04 steps: - name: Checkout repository uses: actions/checkout@v3 - name: Login to Docker Hub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Build and push uses: docker/build-push-action@v4 with: context: . file: ./Dockerfile target: prod build-args: | ENVIRONMENT=production push: true tags: | riggraz/astuto:${{ github.sha }} riggraz/astuto:${{ github.ref_type == 'tag' && github.ref_name || 'latest'}}