Update Nextcloud Docker Images #347
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update Nextcloud Docker Images | |
| on: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| workflow_dispatch: | |
| jobs: | |
| detect: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| matrix: ${{ steps.set-matrix.outputs.matrix }} | |
| steps: | |
| - name: Detect image:tag combinations | |
| id: set-matrix | |
| run: | | |
| combinations=() | |
| # Get available tags and filter out versioned ones | |
| tags=$(curl -s "https://hub.docker.com/v2/repositories/library/nextcloud/tags?page_size=100" | \ | |
| jq -r '.results[].name | select(test("^[0-9]") | not)') | |
| for tag in $tags; do | |
| manifest=$(docker manifest inspect nextcloud:$tag) | |
| if [ $? -eq 0 ]; then | |
| our_manifest=$(docker manifest inspect ${{ secrets.DOCKERHUB_USERNAME }}/nextcloud:$tag 2>/dev/null || echo '{"manifests":[]}') | |
| base_digest=$(echo "$manifest" | jq -r '.manifests[0].digest // ""') | |
| our_digest=$(echo "$our_manifest" | jq -r '.manifests[0].digest // ""') | |
| if [[ -n "$base_digest" && "$base_digest" != "$our_digest" ]]; then | |
| archs=$(echo "$manifest" | jq -r '.manifests[].platform | select(.os != "unknown" and .architecture != "unknown") | .os + "/" + .architecture + if .variant then "/" + .variant else "" end' | sort | uniq) | |
| combinations+=("{\"tag\":\"$tag\",\"platforms\":\"$(echo $archs | tr '\n' ',')\"}") | |
| fi | |
| fi | |
| done | |
| echo "matrix={\"include\":[$(echo ${combinations[@]} | tr ' ' ',')]}" >> $GITHUB_OUTPUT | |
| build: | |
| needs: detect | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: ${{fromJson(needs.detect.outputs.matrix)}} | |
| fail-fast: false | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Login to DockerHub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and Push Nextcloud Image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: Dockerfile | |
| build-args: | | |
| IMAGE=nextcloud | |
| TAG=${{ matrix.tag }} | |
| push: true | |
| tags: ${{ secrets.DOCKERHUB_USERNAME }}/nextcloud:${{ matrix.tag }} | |
| platforms: ${{ matrix.platforms }} | |
| provenance: false | |
| sbom: false |