mirror of
https://github.com/Viren070/AIOStreams.git
synced 2025-12-01 23:14:04 +01:00
63 lines
2.0 KiB
YAML
63 lines
2.0 KiB
YAML
name: Deploy Docker image to GitHub Container Registry and Docker Hub
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*' # Trigger on any tag that starts with 'v'
|
|
branches:
|
|
- main # Trigger on push to main branch
|
|
|
|
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
|
|
|
|
# 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
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
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)
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
tags: |
|
|
ghcr.io/viren070/aiostreams:${{ github.ref_name }}
|
|
ghcr.io/viren070/aiostreams:latest
|
|
docker.io/${{ secrets.DOCKERHUB_USERNAME }}/aiostreams:${{ github.ref_name }}
|
|
docker.io/${{ secrets.DOCKERHUB_USERNAME }}/aiostreams:latest
|
|
|
|
# Build and push Docker image to GHCR only for each commit to main branch
|
|
- name: Build and push Docker image (dev)
|
|
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
tags: ghcr.io/viren070/aiostreams:dev
|