support selfhosted container registry
This commit is contained in:
parent
6c925f1450
commit
0850e705ce
3 changed files with 39 additions and 28 deletions
10
.github/workflows/build-pr.yml
vendored
10
.github/workflows/build-pr.yml
vendored
|
|
@ -24,16 +24,13 @@ jobs:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
# Python setup and testing
|
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: ${{ env.PYTHON_VERSION }}
|
python-version: ${{ env.PYTHON_VERSION }}
|
||||||
|
|
||||||
- name: Install uv
|
- name: Install uv
|
||||||
uses: astral-sh/setup-uv@v4
|
run: pip install uv
|
||||||
with:
|
|
||||||
version: "latest"
|
|
||||||
|
|
||||||
- name: Install Python dependencies
|
- name: Install Python dependencies
|
||||||
run: uv sync
|
run: uv sync
|
||||||
|
|
@ -44,7 +41,6 @@ jobs:
|
||||||
- name: Run Python tests
|
- name: Run Python tests
|
||||||
run: uv run pytest app/tests/ -v --tb=short
|
run: uv run pytest app/tests/ -v --tb=short
|
||||||
|
|
||||||
# Frontend setup and testing
|
|
||||||
- name: Install pnpm
|
- name: Install pnpm
|
||||||
uses: pnpm/action-setup@v4
|
uses: pnpm/action-setup@v4
|
||||||
with:
|
with:
|
||||||
|
|
@ -85,10 +81,6 @@ jobs:
|
||||||
working-directory: ui
|
working-directory: ui
|
||||||
run: pnpm run generate
|
run: pnpm run generate
|
||||||
|
|
||||||
# Quick Docker build validation (no push, cache only)
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Validate Docker build
|
- name: Validate Docker build
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
|
|
|
||||||
53
.github/workflows/main.yml
vendored
53
.github/workflows/main.yml
vendored
|
|
@ -22,6 +22,7 @@ on:
|
||||||
- ".github/ISSUE_TEMPLATE/**"
|
- ".github/ISSUE_TEMPLATE/**"
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
REGISTRY: ${{ vars.REGISTRY != '' && vars.REGISTRY || '' }}
|
||||||
DOCKERHUB_SLUG: arabcoders/ytptube
|
DOCKERHUB_SLUG: arabcoders/ytptube
|
||||||
GHCR_SLUG: ghcr.io/arabcoders/ytptube
|
GHCR_SLUG: ghcr.io/arabcoders/ytptube
|
||||||
PNPM_VERSION: 10
|
PNPM_VERSION: 10
|
||||||
|
|
@ -40,18 +41,13 @@ jobs:
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
# Python setup and testing
|
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: ${{ env.PYTHON_VERSION }}
|
python-version: ${{ env.PYTHON_VERSION }}
|
||||||
|
|
||||||
- name: Install uv
|
- name: Install uv
|
||||||
uses: astral-sh/setup-uv@v6.7
|
run: pip install uv
|
||||||
with:
|
|
||||||
enable-cache: true
|
|
||||||
save-cache: true
|
|
||||||
version: "latest"
|
|
||||||
|
|
||||||
- name: Install Python dependencies
|
- name: Install Python dependencies
|
||||||
run: uv sync
|
run: uv sync
|
||||||
|
|
@ -62,7 +58,6 @@ jobs:
|
||||||
- name: Run Python tests
|
- name: Run Python tests
|
||||||
run: uv run pytest app/tests/ -v --tb=short
|
run: uv run pytest app/tests/ -v --tb=short
|
||||||
|
|
||||||
# Frontend setup and testing
|
|
||||||
- name: Install pnpm
|
- name: Install pnpm
|
||||||
uses: pnpm/action-setup@v4
|
uses: pnpm/action-setup@v4
|
||||||
with:
|
with:
|
||||||
|
|
@ -138,6 +133,7 @@ jobs:
|
||||||
packages: write
|
packages: write
|
||||||
contents: write
|
contents: write
|
||||||
env:
|
env:
|
||||||
|
SLUG: ${{ format('{0}/{1}', env.REGISTRY, github.repository) }}
|
||||||
ARCH: ${{ matrix.arch }}
|
ARCH: ${{ matrix.arch }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
|
@ -178,8 +174,9 @@ jobs:
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
images: |
|
images: |
|
||||||
${{ env.DOCKERHUB_SLUG }}
|
name=${{ env.DOCKERHUB_SLUG }},enable=${{ env.REGISTRY == '' }}
|
||||||
${{ env.GHCR_SLUG }}
|
name=${{ env.GHCR_SLUG }},enable=${{ env.REGISTRY == '' }}
|
||||||
|
name=${{ env.REGISTRY }}/${{ github.repository }},enable=${{ env.REGISTRY != '' }}
|
||||||
flavor: |
|
flavor: |
|
||||||
latest=false
|
latest=false
|
||||||
suffix=-${{ env.ARCH }}
|
suffix=-${{ env.ARCH }}
|
||||||
|
|
@ -188,8 +185,17 @@ jobs:
|
||||||
type=ref,event=tag
|
type=ref,event=tag
|
||||||
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
|
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
|
||||||
|
|
||||||
|
- name: Login to Private Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
if: env.REGISTRY != ''
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GIT_TOKEN && secrets.GIT_TOKEN || secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Login to GitHub Container Registry
|
- name: Login to GitHub Container Registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
|
if: env.REGISTRY == ''
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
|
|
@ -197,6 +203,7 @@ jobs:
|
||||||
|
|
||||||
- name: Login to DockerHub
|
- name: Login to DockerHub
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
|
if: env.REGISTRY == ''
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
@ -212,13 +219,9 @@ jobs:
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
cache-from: |
|
cache-to: type=gha,mode=max,scope=${{ github.workflow }}
|
||||||
type=gha,scope=${{ github.workflow }}
|
cache-from: type=gha,scope=${{ github.workflow }}
|
||||||
type=registry,ref=ghcr.io/arabcoders/ytptube:buildcache
|
provenance: true
|
||||||
cache-to: |
|
|
||||||
type=gha,mode=max,scope=${{ github.workflow }}
|
|
||||||
type=registry,ref=ghcr.io/arabcoders/ytptube:buildcache,mode=max
|
|
||||||
provenance: false
|
|
||||||
|
|
||||||
docker-publish-manifest:
|
docker-publish-manifest:
|
||||||
name: Publish multi-arch manifest
|
name: Publish multi-arch manifest
|
||||||
|
|
@ -233,8 +236,9 @@ jobs:
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
images: |
|
images: |
|
||||||
${{ env.DOCKERHUB_SLUG }}
|
name=${{ env.DOCKERHUB_SLUG }},enable=${{ env.REGISTRY == '' }}
|
||||||
${{ env.GHCR_SLUG }}
|
name=${{ env.GHCR_SLUG }},enable=${{ env.REGISTRY == '' }}
|
||||||
|
name=${{ env.REGISTRY }}/${{ github.repository }},enable=${{ env.REGISTRY != '' }}
|
||||||
flavor: |
|
flavor: |
|
||||||
latest=false
|
latest=false
|
||||||
tags: |
|
tags: |
|
||||||
|
|
@ -242,8 +246,17 @@ jobs:
|
||||||
type=ref,event=tag
|
type=ref,event=tag
|
||||||
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
|
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
|
||||||
|
|
||||||
|
- name: Login to Private Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
if: env.REGISTRY != ''
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GIT_TOKEN && secrets.GIT_TOKEN || secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Login to GitHub Container Registry
|
- name: Login to GitHub Container Registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
|
if: env.REGISTRY == ''
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
|
|
@ -251,6 +264,7 @@ jobs:
|
||||||
|
|
||||||
- name: Login to DockerHub
|
- name: Login to DockerHub
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
|
if: env.REGISTRY == ''
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
@ -268,7 +282,7 @@ jobs:
|
||||||
done
|
done
|
||||||
|
|
||||||
- name: Overwrite GitHub release notes
|
- name: Overwrite GitHub release notes
|
||||||
if: startsWith(github.ref, 'refs/tags/v')
|
if: startsWith(github.ref, 'refs/tags/v') && env.REGISTRY == ''
|
||||||
uses: actions/github-script@v6
|
uses: actions/github-script@v6
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
@ -322,6 +336,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Sync README
|
- name: Sync README
|
||||||
uses: docker://lsiodev/readme-sync:latest
|
uses: docker://lsiodev/readme-sync:latest
|
||||||
|
if: env.REGISTRY == ''
|
||||||
env:
|
env:
|
||||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
|
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
|
||||||
4
.github/workflows/native-build.yml
vendored
4
.github/workflows/native-build.yml
vendored
|
|
@ -14,8 +14,12 @@ on:
|
||||||
tags:
|
tags:
|
||||||
- "v*"
|
- "v*"
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: ${{ vars.REGISTRY != '' && vars.REGISTRY || '' }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
if: env.REGISTRY == ''
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue