141 lines
No EOL
4.5 KiB
YAML
141 lines
No EOL
4.5 KiB
YAML
name: Release Docker Image
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- v*
|
|
|
|
permissions:
|
|
packages: write
|
|
|
|
env:
|
|
APP_NAME: rdtclient
|
|
DOCKER_FILE: ./Dockerfile
|
|
ENABLE_DOCKERHUB: 1
|
|
ENABLE_GHCR: 1
|
|
|
|
concurrency: ${{ github.sha }}
|
|
|
|
jobs:
|
|
build:
|
|
outputs:
|
|
digest-amd64: ${{ steps.digest.outputs.digest-amd64 }}
|
|
digest-arm64: ${{ steps.digest.outputs.digest-arm64 }}
|
|
strategy:
|
|
matrix:
|
|
config:
|
|
- arch: amd64
|
|
runs-on: ubuntu-latest
|
|
platform: linux/amd64
|
|
- arch: arm64
|
|
runs-on: ubuntu-24.04-arm
|
|
platform: linux/arm64
|
|
runs-on: ${{ matrix.config.runs-on }}
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Extract version and patch .csproj
|
|
run: |
|
|
VERSION="${GITHUB_REF_NAME#v}"
|
|
sed -i "s|<Version>.*</Version>|<Version>$VERSION</Version>|" server/RdtClient.Web/RdtClient.Web.csproj
|
|
sed -i "s|<AssemblyVersion>.*</AssemblyVersion>|<AssemblyVersion>$VERSION</AssemblyVersion>|" server/RdtClient.Web/RdtClient.Web.csproj
|
|
|
|
- name: Login to DockerHub
|
|
if: ${{ env.ENABLE_DOCKERHUB == 1 }}
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Login to GHCR
|
|
if: ${{ env.ENABLE_GHCR == 1 }}
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Docker Metadata action
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: |
|
|
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.APP_NAME }}
|
|
ghcr.io/${{ github.repository_owner }}/${{ env.APP_NAME }}
|
|
|
|
- name: Build and push by digest
|
|
id: build
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.APP_NAME }}
|
|
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
|
|
|
|
- name: Export digest
|
|
id: digest
|
|
run: |
|
|
echo "digest-${{ matrix.config.arch }}=${{ steps.build.outputs.digest }}" >> "$GITHUB_OUTPUT"
|
|
|
|
push-images:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Login to DockerHub
|
|
if: ${{ env.ENABLE_DOCKERHUB == 1 }}
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Login to GHCR
|
|
if: ${{ env.ENABLE_GHCR == 1 }}
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Setup Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Docker Metadata action
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: |
|
|
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.APP_NAME }}
|
|
ghcr.io/${{ github.repository_owner }}/${{ env.APP_NAME }}
|
|
tags: |
|
|
type=schedule
|
|
type=ref,event=branch
|
|
type=ref,event=pr
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
type=semver,pattern={{major}}
|
|
type=sha
|
|
|
|
- name: Create manifest list and push
|
|
run: |
|
|
docker buildx imagetools create \
|
|
$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< '${{ steps.meta.outputs.json }}') \
|
|
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.APP_NAME }}@${{ needs.build.outputs.digest-amd64 }} \
|
|
${{ secrets.DOCKERHUB_USERNAME }}/${{ env.APP_NAME }}@${{ needs.build.outputs.digest-arm64 }}
|
|
|
|
- name: Checkout code
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Docker Hub Registry Description
|
|
if: ${{ env.ENABLE_DOCKERHUB == 1 }}
|
|
uses: peter-evans/dockerhub-description@v4
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
repository: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.APP_NAME }}
|
|
short-description: |
|
|
A web interface to manage your torrents on debrid providers.
|
|
readme-filepath: ./README-DOCKER.md |