diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 740972d..b244619 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -6,8 +6,7 @@ name: Publish on Docker & ghcr.io # documentation. on: - # schedule: - # - cron: '15 6 * * *' + # On push commit trigger push: # branches: # - develop @@ -16,8 +15,15 @@ on: # branches: # - develop # - beta + + # Allows manual trigger workflow_dispatch: + # Allows external webhook trigger + repository_dispatch: + types: + - "Plex Beta Update Webhook" + env: # Use docker.io for Docker Hub if empty REGISTRY: ghcr.io @@ -35,13 +41,19 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 # Login Docker Hub registry except on PR # https://github.com/docker/login-action - name: Log in to Docker Hub if: github.event_name != 'pull_request' - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} @@ -49,7 +61,7 @@ jobs: # https://github.com/docker/login-action - name: Log into registry ${{ env.REGISTRY }} if: github.event_name != 'pull_request' - uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c + uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} @@ -59,20 +71,46 @@ jobs: # https://github.com/docker/metadata-action - name: Extract Docker metadata id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + uses: docker/metadata-action@v5 with: tags: | type=ref,event=branch images: | - ${{ github.repository }} + ${{ env.IMAGE_NAME }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} # Build and push Docker image with Buildx (don't push on PR) # https://github.com/docker/build-push-action - name: Build and push Docker image - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + uses: docker/build-push-action@v5 with: context: . + platforms: linux/amd64,linux/arm64 push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + + # Extract metadata (tags, labels) for Docker (Plexdrive 5.2.1) + # https://github.com/docker/metadata-action + - name: Extract Docker metadata (Plexdrive 5.2.1) + id: meta_pd521 + uses: docker/metadata-action@v5 + with: + tags: | + type=ref,event=branch,suffix=-pd521 + images: | + ${{ env.IMAGE_NAME }} + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + # Build and push Docker image (Plexdrive 5.2.1) with Buildx (don't push on PR) + # https://github.com/docker/build-push-action + - name: Build and push Docker image (Plexdrive 5.2.1) + uses: docker/build-push-action@v5 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: ${{ github.event_name != 'pull_request' }} + build-args: | + PLEXDRIVE_VERSION=5.2.1 + tags: ${{ steps.meta_pd521.outputs.tags }} + labels: ${{ steps.meta_pd521.outputs.labels }} diff --git a/root/plexdrive-install.sh b/root/plexdrive-install.sh index 3854809..4733462 100755 --- a/root/plexdrive-install.sh +++ b/root/plexdrive-install.sh @@ -1,10 +1,22 @@ #!/bin/sh -# Plexdrive updater +# Plexdrive installer + +# Determine architecture +ARCH=$(dpkg --print-architecture) +# Validate architecture +if [ "$ARCH" != "amd64" ] && [ "$ARCH" != "arm64" ]; then + echo "Arquitectura no soportada: $ARCH. El script solo soporta amd64 y arm64." + exit 1 +fi + +# Get plexdrive cd /tmp -wget "https://github.com/plexdrive/plexdrive/releases/download/$PLEXDRIVE_VERSION/plexdrive-linux-$ARCH" -q -O plexdrive +echo "Downloading https://github.com/plexdrive/plexdrive/releases/download/$PLEXDRIVE_VERSION/plexdrive-linux-$ARCH" +wget "https://github.com/plexdrive/plexdrive/releases/download/$PLEXDRIVE_VERSION/plexdrive-linux-$ARCH" --no-verbose -O plexdrive chmod -c +x /tmp/plexdrive version=$(/tmp/plexdrive --version) + +# Install plexdrive echo "Installing Plexdrive v. ${version}" -#install plexdrive mv -v /tmp/plexdrive /usr/local/bin/ chown -c root:root /usr/local/bin/plexdrive