Skip to content

Commit

Permalink
ci(docker-publish): split publish.yml workflow into GPR and DockerHub…
Browse files Browse the repository at this point in the history
… workflows
  • Loading branch information
demartini committed May 22, 2024
1 parent 8f1ddd8 commit 546f2ab
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 54 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/docker-publish-gpr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Publish Docker Image (GPR)

on:
release:
types: [published]

env:
REGISTRY: ghcr.io
IMAGE_NAME: demartini/transmission-discord-bot

jobs:
push_to_registry:
name: Push Docker image to GitHub Packages
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Check out the repo
uses: actions/[email protected]

- name: Set up QEMU
uses: docker/[email protected]

- name: Set up Docker Buildx
uses: docker/[email protected]

- name: Log in to the Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker Image
uses: docker/[email protected]
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
40 changes: 40 additions & 0 deletions .github/workflows/docker-publish-hub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Publish Docker Image (Hub)

on:
release:
types: [published]

jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/[email protected]

- name: Set up QEMU
uses: docker/[email protected]

- name: Set up Docker Buildx
uses: docker/[email protected]

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/[email protected]
with:
images: demartini/transmission-discord-bot

- name: Build and push Docker Image
uses: docker/[email protected]
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
54 changes: 0 additions & 54 deletions .github/workflows/publish.yml

This file was deleted.

0 comments on commit 546f2ab

Please sign in to comment.