Bump peter-evans/dockerhub-description from 3 to 4 #46
This file contains 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: buildx | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'master' | |
pull_request: | |
env: | |
DOCKERHUB_USER: wiserain | |
IMAGE_NAME: wiserain/plexdrive | |
jobs: | |
buildx: | |
runs-on: ubuntu-22.04 | |
if: github.event_name != 'pull_request' | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- | |
name: Set up Buildx | |
uses: docker/setup-buildx-action@v3 | |
- | |
name: Initial Buildx | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: Dockerfile | |
tags: ${{ env.IMAGE_NAME }}:testing | |
platforms: linux/amd64,linux/arm/v7,linux/arm64 | |
- | |
name: Load Built Image and Get Variables | |
id: vars | |
run: | | |
docker buildx build \ | |
-t ${{ env.IMAGE_NAME }}:testing \ | |
--platform=linux/amd64 \ | |
--load \ | |
. | |
CID=$(docker run -d ${{ env.IMAGE_NAME }}:testing) | |
VER_FULL=$(docker exec $CID plexdrive --version) | |
echo "VER_FULL=$VER_FULL" >> $GITHUB_ENV | |
docker rm -f $CID | |
VER_MINOR=$(echo $VER_FULL | cut -d. -f-2) | |
echo "VER_MINOR=$VER_MINOR" >> $GITHUB_ENV | |
VER_MAJOR=$(echo $VER_FULL | cut -d. -f-1) | |
echo "VER_MAJOR=$VER_MAJOR" >> $GITHUB_ENV | |
- | |
name: Login to docker.io | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ env.DOCKERHUB_USER }} | |
password: ${{ secrets.DOCKERHUB_PASS }} | |
- | |
name: Login to ghcr.io | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GHCR_PAT }} | |
- | |
name: Buildx and Push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: Dockerfile | |
tags: | | |
${{ env.IMAGE_NAME }}:latest | |
${{ env.IMAGE_NAME }}:${{ env.VER_FULL }} | |
${{ env.IMAGE_NAME }}:${{ env.VER_MINOR }} | |
${{ env.IMAGE_NAME }}:${{ env.VER_MAJOR }} | |
ghcr.io/${{ env.IMAGE_NAME }}:latest | |
ghcr.io/${{ env.IMAGE_NAME }}:${{ env.VER_FULL }} | |
ghcr.io/${{ env.IMAGE_NAME }}:${{ env.VER_MINOR }} | |
ghcr.io/${{ env.IMAGE_NAME }}:${{ env.VER_MAJOR }} | |
platforms: linux/amd64,linux/arm/v7,linux/arm64 | |
push: true | |
- | |
name: Update Dockerhub description | |
uses: peter-evans/dockerhub-description@v4 | |
with: | |
username: ${{ env.DOCKERHUB_USER }} | |
password: ${{ secrets.DOCKERHUB_PASS }} | |
repository: ${{ env.IMAGE_NAME }} | |
short-description: ${{ steps.vars.outputs.github_desc }} | |
- | |
name: Notification | |
uses: sarisia/actions-status-discord@v1 | |
if: always() | |
with: | |
webhook: ${{ secrets.DISCORD_WEBHOOK }} | |
status: ${{ job.status }} | |
description: | | |
${{ env.IMAGE_NAME }}:latest | |
${{ env.IMAGE_NAME }}:${{ env.VER_FULL }} | |
${{ env.IMAGE_NAME }}:${{ env.VER_MINOR }} | |
${{ env.IMAGE_NAME }}:${{ env.VER_MAJOR }} | |
ghcr.io/${{ env.IMAGE_NAME }}:latest | |
ghcr.io/${{ env.IMAGE_NAME }}:${{ env.VER_FULL }} | |
ghcr.io/${{ env.IMAGE_NAME }}:${{ env.VER_MINOR }} | |
ghcr.io/${{ env.IMAGE_NAME }}:${{ env.VER_MAJOR }} | |
buildx-on-pr: | |
runs-on: ubuntu-22.04 | |
if: github.event_name == 'pull_request' | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- | |
name: Set up Buildx | |
uses: docker/setup-buildx-action@v3 | |
- | |
name: Initial Buildx | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: Dockerfile | |
tags: ${{ env.IMAGE_NAME }}:testing | |
platforms: linux/amd64,linux/arm/v7,linux/arm64 | |
- | |
name: Login to docker.io | |
uses: docker/login-action@v3 | |
if: github.actor == github.event.repository.owner.login | |
with: | |
username: ${{ env.DOCKERHUB_USER }} | |
password: ${{ secrets.DOCKERHUB_PASS }} | |
- | |
name: Login to ghcr.io | |
uses: docker/login-action@v3 | |
if: github.actor == github.event.repository.owner.login | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GHCR_PAT }} | |
- | |
name: Buildx and Push | |
uses: docker/build-push-action@v5 | |
if: github.actor == github.event.repository.owner.login | |
with: | |
context: . | |
file: Dockerfile | |
tags: | | |
${{ env.IMAGE_NAME }}:testing | |
${{ env.IMAGE_NAME }}:testing-${{ github.event.pull_request.number }} | |
ghcr.io/${{ env.IMAGE_NAME }}:testing | |
ghcr.io/${{ env.IMAGE_NAME }}:testing-${{ github.event.pull_request.number }} | |
platforms: linux/amd64,linux/arm/v7,linux/arm64 | |
push: true | |
- | |
name: Notification | |
uses: sarisia/actions-status-discord@v1 | |
if: always() && github.actor == github.event.repository.owner.login | |
with: | |
webhook: ${{ secrets.DISCORD_WEBHOOK }} | |
status: ${{ job.status }} | |
description: | | |
${{ env.IMAGE_NAME }}:testing | |
${{ env.IMAGE_NAME }}:testing-${{ github.event.pull_request.number }} | |
ghcr.io/${{ env.IMAGE_NAME }}:testing | |
ghcr.io/${{ env.IMAGE_NAME }}:testing-${{ github.event.pull_request.number }} |