Build and Push Nextcloud with ffmpeg #121
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: Build and Push Nextcloud with ffmpeg | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 3 * * *" | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Restore upstream SHA cache | |
| id: cache-sha | |
| uses: actions/cache@v4 | |
| with: | |
| path: .last_upstream_sha | |
| key: upstream-sha-nextcloud-apache | |
| - name: Check upstream image SHA | |
| id: checksha | |
| run: | | |
| UPSTREAM_IMAGE="nextcloud:apache" | |
| SHA_FILE=".last_upstream_sha" | |
| DIGEST=$(docker manifest inspect "$UPSTREAM_IMAGE" | jq -r '.manifests[] | select(.platform.architecture=="amd64" and .platform.os=="linux") | .digest') | |
| echo "Upstream amd64 image digest: $DIGEST" | |
| SHOULD_BUILD=true | |
| if [ -f "$SHA_FILE" ]; then | |
| LAST_DIGEST=$(cat "$SHA_FILE") | |
| if [ "$DIGEST" = "$LAST_DIGEST" ]; then | |
| echo "No change in upstream image. Skipping build." | |
| SHOULD_BUILD=false | |
| fi | |
| fi | |
| echo "$DIGEST" > "$SHA_FILE" | |
| echo "should_build=$SHOULD_BUILD" >> $GITHUB_OUTPUT | |
| - name: Log in to GHCR | |
| if: steps.checksha.outputs.should_build == 'true' | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push image | |
| if: steps.checksha.outputs.should_build == 'true' | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| tags: | | |
| ghcr.io/${{ github.repository_owner }}/nextcloud-ffmpeg:latest |