2023-09-19 19:12:38 +02:00
name : Build
on :
2024-04-19 05:43:39 +02:00
schedule :
- cron : "0 0 * * 1"
2023-09-19 19:12:38 +02:00
push :
2023-09-19 19:15:47 +02:00
tags :
2024-04-19 05:43:39 +02:00
- 'manual_build'
2023-09-19 19:12:38 +02:00
jobs :
2024-04-28 00:36:47 +02:00
build-stable :
2024-04-19 05:43:39 +02:00
runs-on : ubuntu-latest
2023-09-19 19:12:38 +02:00
steps :
- name : Extract Version Tag
id : extract-version
2024-04-19 05:43:39 +02:00
run : |
2024-04-28 00:36:47 +02:00
export DIGEST=$(curl -s "https://registry.hub.docker.com/v2/repositories/library/nextcloud/tags/?page_size=100" | jq -r '.results[] | select(.name=="stable") .digest')
export VERSION=$(curl -s "https://registry.hub.docker.com/v2/repositories/library/nextcloud/tags/?page_size=1000" | jq -r ".results[] | select(.name | test(\"^([0-9]+\\\.)+[0-9]+$\")) | select(.digest==\"$DIGEST\").name")
export VERSION_MAJOR=$(curl -s "https://registry.hub.docker.com/v2/repositories/library/nextcloud/tags/?page_size=1000" | jq -r ".results[] | select(.name | test(\"^[0-9]{1,2}$\")) | select(.digest==\"$DIGEST\").name")
2024-04-19 05:43:39 +02:00
echo "Latest version: $VERSION"
2024-04-28 00:36:47 +02:00
echo "Major version: $VERSION_MAJOR"
2024-04-19 05:43:39 +02:00
echo "version=${VERSION}" >> $GITHUB_OUTPUT
2024-04-28 00:36:47 +02:00
echo "version-major=${VERSION_MAJOR}" >> $GITHUB_OUTPUT
2023-09-19 19:12:38 +02:00
shell : bash
2024-04-19 05:43:39 +02:00
- name : Check if the image was already built
id : check-build-status
2023-09-19 19:12:38 +02:00
run : |
2024-04-19 05:43:39 +02:00
if curl --silent -f -lSL "https://hub.docker.com/v2/repositories/jiriks74/nextcloud-extended/tags/$(echo ${{steps.extract-version.outputs.version}})" 2> /dev/null; then echo "Built already!" && exit 1; else echo "This version isn't built yet."; fi
- name : Update repositories
run : sudo apt update
- name : Install Docker
uses : awalsh128/cache-apt-pkgs-action@latest
with :
packages : docker.io
2023-09-19 21:53:49 +02:00
- name : Login to DockerHub
2024-04-19 05:43:39 +02:00
uses : docker/login-action@v3
2023-09-19 21:53:49 +02:00
with :
username : ${{ secrets.DOCKERHUB_USERNAME }}
password : ${{ secrets.DOCKERHUB_TOKEN }}
2023-09-19 19:12:38 +02:00
- name : Set up QEMU
2024-04-19 05:43:39 +02:00
uses : docker/setup-qemu-action@v3
2023-09-19 19:12:38 +02:00
- name : Set up Docker Buildx
2024-04-19 05:43:39 +02:00
uses : docker/setup-buildx-action@v3
2023-09-19 19:12:38 +02:00
with :
2024-04-19 05:43:39 +02:00
# driver-opts: network=host
2023-09-19 19:12:38 +02:00
platforms : linux/amd64,linux/arm64
2024-04-19 05:43:39 +02:00
- name : Checkout
uses : actions/checkout@v4
2023-09-19 19:12:38 +02:00
- name : Build image
uses : docker/build-push-action@v2
with :
push : true
2024-04-28 00:36:47 +02:00
tags : jiriks74/nextcloud-extended:${{ steps.extract-version.outputs.version }},jiriks74/nextcloud-extended:${{ steps.extract-version.outputs.version-major }},jiriks74/nextcloud-extended:stable
2023-09-19 19:12:38 +02:00
platforms : linux/amd64,linux/arm64
context : .
file : ./Dockerfile