Skip to content

Commit

Permalink
add initial GitHub action for building and pushing Docker images
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Stadler <[email protected]>
  • Loading branch information
peterstadler committed Apr 2, 2024
1 parent 71fdf99 commit 4e1db70
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Docker

on:
# run on every push to any branch
push:

jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
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 against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log in to GitHub registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: TEITechnicalCouncil
password: ${{ secrets.TEITECHNICALCOUNCIL_PACKAGES_TOKEN }}

# Login against DockerHub registry except on PR
- name: Log in to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.PETERS_DOCKERHUB_USERNAME }}
password: ${{ secrets.PETERS_DOCKERHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/teic/romajs
teic/romajs
flavor: |
latest=${{ github.ref == 'refs/heads/main' }}
# 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@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
platforms: |
linux/amd64
linux/arm64/v8
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 4e1db70

Please sign in to comment.