Skip to content

Commit

Permalink
Test docker hub and github
Browse files Browse the repository at this point in the history
  • Loading branch information
diogopms committed Aug 19, 2024
1 parent 4779c8c commit 80eacb4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
34 changes: 23 additions & 11 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@ name: Build and Push Docker Image

on:
push:
tags: ["*"]
branches:
- main
tags:
- "*"

jobs:
build:
runs-on: ubuntu-latest
permissions:
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand All @@ -33,19 +38,26 @@ jobs:
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GH_DOCKER_REGISTRY }}
password: ${{ secrets.GH_TOKEN }}

- name: Extract Docker metadata (tags, labels)
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/${{ github.repository_owner }}/postgres-gcs-backup
${{ secrets.DOCKERHUB_USERNAME }}/postgres-gcs-backup
tags: |
type=ref,event=branch,pattern=main
type=ref,event=tag
custom_labels: |
latest
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/postgres-gcs-backup:${{ github.ref_name }}
${{ secrets.DOCKERHUB_USERNAME }}/postgres-gcs-backup:latest
ghcr.io/${{ github.repository_owner }}/postgres-gcs-backup:${{ github.ref_name }}
ghcr.io/${{ github.repository_owner }}/postgres-gcs-backup:latest
- name: Image digest
run: echo "Image digest is ${{ steps.build.outputs.digest }}"
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ You can pull the public image from Docker Hub:

docker pull diogopms/postgres-gcs-backup:latest

Or pull the public image from Github Registry:

docker pull ghcr.io/diogopms/postgres-gcs-backup:latest

### Configuration

The following table lists the configurable parameters you can set up.
Expand Down

0 comments on commit 80eacb4

Please sign in to comment.