82 lignes
2.5 KiB
YAML
82 lignes
2.5 KiB
YAML
name: Build & Push Nextcloud Docker Image (registry cache)
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: "Nextcloud version (ex: 26.0.1). Leave empty for latest"
|
|
required: false
|
|
latest:
|
|
description: "Tag as latest (true/false)"
|
|
required: false
|
|
default: "false"
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install tools
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y curl jq
|
|
|
|
- name: Determine Nextcloud version
|
|
run: |
|
|
if [ -z "${{ inputs.version }}" ]; then
|
|
NC_VERS=$(curl -s https://api.github.com/repos/nextcloud/server/releases/latest \
|
|
| jq -r '.tag_name' | tr -d 'v')
|
|
else
|
|
NC_VERS="${{ inputs.version }}"
|
|
fi
|
|
|
|
MAJOR_VERS=$(echo "$NC_VERS" | cut -d. -f1)
|
|
|
|
if [ "$MAJOR_VERS" -lt 24 ]; then
|
|
echo "Unsupported Nextcloud major version: $MAJOR_VERS"
|
|
exit 1
|
|
fi
|
|
|
|
echo "NC_VERS=$NC_VERS" >> $GITHUB_ENV
|
|
echo "MAJOR_VERS=$MAJOR_VERS" >> $GITHUB_ENV
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Login to Gitea Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: git.celjim.fr
|
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
|
|
- name: Build & push with registry cache
|
|
run: |
|
|
docker buildx build \
|
|
--push \
|
|
--build-arg NC_VERS=$NC_VERS \
|
|
--cache-from type=registry,ref=git.celjim.fr/jimmygalland/nextcloud:buildcache \
|
|
--cache-to type=registry,ref=git.celjim.fr/jimmygalland/nextcloud:buildcache,mode=max \
|
|
-t jimmygalland/nextcloud:$NC_VERS \
|
|
-t git.celjim.fr/jimmygalland/nextcloud:$NC_VERS \
|
|
./$MAJOR_VERS
|
|
|
|
- name: Tag & push latest
|
|
if: ${{ inputs.latest == 'true' }}
|
|
run: |
|
|
docker tag jimmygalland/nextcloud:$NC_VERS jimmygalland/nextcloud:latest
|
|
docker tag jimmygalland/nextcloud:$NC_VERS git.celjim.fr/jimmygalland/nextcloud:latest
|
|
|
|
docker push jimmygalland/nextcloud:latest
|
|
docker push git.celjim.fr/jimmygalland/nextcloud:latest
|
|
|