name: Deploy Docker image to GitHub Container Registry and Docker Hub on: push: tags: - 'v*' # Trigger on any tag that starts with 'v' workflow_dispatch: # Allow manual triggering of workflow inputs: tag: description: 'Tag to deploy' required: true jobs: docker: runs-on: ubuntu-latest steps: # Checkout the repository - name: Checkout repository uses: actions/checkout@v4 # Set up QEMU for multi-platform builds - name: Set up QEMU uses: docker/setup-qemu-action@v3 # Set up Docker Buildx - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 # Determine the tag to deploy - name: Determine tag to deploy id: tag run: | if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then echo "TAG=${{ github.event.inputs.tag }}" >> $GITHUB_ENV else echo "TAG=${{ github.ref_name }}" >> $GITHUB_ENV fi # Log in to GitHub Container Registry (GHCR) - name: Log in to GitHub Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} # Log in to Docker Hub - name: Log in to Docker Hub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} # Build and push Docker image to both GHCR and Docker Hub - name: Build and push Docker image (tags) uses: docker/build-push-action@v6 with: platforms: linux/amd64,linux/arm64 push: true tags: | ghcr.io/${{ secrets.GHCR_LOWERCASE_USERNAME }}/aiostremio:${{ env.TAG }} ghcr.io/${{ secrets.GHCR_LOWERCASE_USERNAME }}/aiostremio:latest docker.io/${{ secrets.DOCKERHUB_USERNAME }}/aiostremio:${{ env.TAG }} docker.io/${{ secrets.DOCKERHUB_USERNAME }}/aiostremio:latest