Skip to content

Publish Docker Image on Release #10

Publish Docker Image on Release

Publish Docker Image on Release #10

name: Publish Docker Image on Release
on:
release:
types:
- published
permissions:
contents: read
packages: write
jobs:
build-and-push:
name: Build and Push Multi-Platform Docker Image
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Log in to GitHub Container Registry
uses: docker/#-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
install: true
- name: Set Lowercase Repository Info
id: repo_info
run: |
echo "REPO_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
echo "REPO_NAME=$(echo ${{ github.event.repository.name }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Build and Push Multi-Platform Docker Image
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/${{ env.REPO_OWNER }}/${{ env.REPO_NAME }}:latest
ghcr.io/${{ env.REPO_OWNER }}/${{ env.REPO_NAME }}:${{ github.event.release.tag_name }}
labels: |
org.opencontainers.image.title=fortsphere
org.opencontainers.image.description="Fortify your digital sphere, one command at a time."
org.opencontainers.image.url=https://github.com/OpenPathfinder/fortSphere
org.opencontainers.image.source=https://github.com/OpenPathfinder/fortSphere.git
org.opencontainers.image.version=${{ github.event.release.tag_name }}
org.opencontainers.image.licenses=MIT
maintainer="Ulises Gascón <ulises@linux.com>"