68 lines
2.2 KiB
YAML
68 lines
2.2 KiB
YAML
name: Build Prowlarr Container
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- develop
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Set build variables
|
|
id: vars
|
|
run: |
|
|
# Date ISO 8601
|
|
echo "build_date=$(date -u +%Y-%m-%dT%H:%M:%S%z)" >> "$GITHUB_OUTPUT"
|
|
|
|
# Short SHA
|
|
echo "sha_short=$(echo ${GITHUB_SHA} | cut -c1-7)" >> "$GITHUB_OUTPUT"
|
|
|
|
# Prowlarr version from upstream API
|
|
PROWLARR_BRANCH="develop"
|
|
if [ "${GITHUB_REF_NAME}" = "main" ]; then
|
|
PROWLARR_BRANCH="master"
|
|
fi
|
|
echo "prowlarr_branch=${PROWLARR_BRANCH}" >> "$GITHUB_OUTPUT"
|
|
|
|
PROWLARR_VERSION=$(curl -sL "https://prowlarr.servarr.com/v1/update/${PROWLARR_BRANCH}/changes?runtime=netcore&os=linuxmusl" | jq -r '.[0].version')
|
|
echo "prowlarr_version=${PROWLARR_VERSION}" >> "$GITHUB_OUTPUT"
|
|
|
|
# Image name
|
|
REGISTRY="${{ vars.OCI_REGISTRY }}"
|
|
# Remove trailing slash if present
|
|
REGISTRY="${REGISTRY%/}"
|
|
echo "image_name=${REGISTRY}/prowlarr" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Login to OCI Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ vars.OCI_REGISTRY }}
|
|
username: ${{ vars.OCI_USERNAME }}
|
|
password: ${{ vars.OCI_PASSWORD }}
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
push: true
|
|
build-args: |
|
|
BUILD_DATE=${{ steps.vars.outputs.build_date }}
|
|
VERSION=${{ steps.vars.outputs.prowlarr_version }}-custom
|
|
PROWLARR_BRANCH=${{ steps.vars.outputs.prowlarr_branch }}
|
|
tags: |
|
|
${{ steps.vars.outputs.image_name }}:latest
|
|
${{ steps.vars.outputs.image_name }}:${{ steps.vars.outputs.sha_short }}
|
|
${{ steps.vars.outputs.image_name }}:${{ steps.vars.outputs.prowlarr_version }}-custom
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|