Skip to content

oci-mosquitto-build #14

oci-mosquitto-build

oci-mosquitto-build #14

Workflow file for this run

name: oci-mosquitto-build
env:
OCI_APP_NAME: mosquitto
IMAGE_PREFIX: oci-
on:
workflow_dispatch: {}
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Docker Setup QEMU
uses: docker/setup-qemu-action@v3 # https://github.com/marketplace/actions/docker-setup-qemu
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 # https://github.com/marketplace/actions/docker-setup-buildx
# Enable "Workflow permissions" to "R/W" into https://github.com/thomaschampagne/${repo}/settings/actions
- name: Log into GitHub Container Registry
uses: docker/login-action@v3 # https://github.com/marketplace/actions/docker-login
with:
registry: ghcr.io
username: ${{ github.action }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set 'ISO' date to "BUILD_DATE" env variable
run: echo "BUILD_DATE=$(date -Is)" >> $GITHUB_ENV
- name: Set 'YYYYMMDD' date to "BUILD_DATE_SHORT" env variable
run: echo "BUILD_DATE_SHORT=$(date +%Y.%m.%d)" >> $GITHUB_ENV
# Push to GitHub Container Registry
- name: Push to Github Container Registry
uses: docker/build-push-action@v5 # https://github.com/marketplace/actions/build-and-push-docker-images
with:
context: ./${{ env.OCI_APP_NAME }}
build-args: |
OCI_APP_NAME=${{ env.OCI_APP_NAME}}
OCI_REPO_URL=https://github.com/${{ github.repository }}/tree/${{ github.ref_name }}/${{ env.OCI_APP_NAME }}
OCI_BUILD_DATE=${{ env.BUILD_DATE }}
platforms: linux/amd64,linux/arm64
provenance: false
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_PREFIX }}${{ env.OCI_APP_NAME }}:latest
ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_PREFIX }}${{ env.OCI_APP_NAME }}:${{ env.BUILD_DATE_SHORT }}