Skip to content

Commit

Permalink
use Vox Pupulis container action
Browse files Browse the repository at this point in the history
  • Loading branch information
rwaffen committed Aug 29, 2023
1 parent 882d538 commit 8a42630
Showing 1 changed file with 5 additions and 50 deletions.
55 changes: 5 additions & 50 deletions .github/workflows/build_docker.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: publish 🐳 Docker image
name: Build and publish a 🛢️ container

on:
push:
Expand All @@ -10,58 +10,13 @@ on:
- '*'

jobs:
build-and-push-image:
build-and-push-container:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to the Container registry
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Get tags
shell: python
run: |
import re
import os
from packaging.version import parse
image = "ghcr.io/${{ github.repository }}"
tags = set()
version = "${{ github.ref_name }}"
if version.startswith('v'):
version = "${{ github.ref_name }}".replace("v", "")
tags.add(f"{image}:latest")
if version == 'main':
version = "development"
tags.add(f"{image}:{version}")
tags = ",".join(sorted(list(tags)))
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
print(f'tags={tags}', file=fh)
id: tags

- name: Build and push
uses: docker/build-push-action@v4
- uses: voxpupuli/gha-build-and-publish-a-container@e8eaaaa2b02fdd2bf0f47c5cb07f120353e5ecf4
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.tags.outputs.tags }}
github_token: ${{ secrets.GITHUB_TOKEN }}
build_arch: linux/amd64,linux/arm64

0 comments on commit 8a42630

Please sign in to comment.