Skip to content

build-on-commit

build-on-commit #15

name: build-on-commit
on:
workflow_dispatch:
push:
branches:
- "**"
tags:
- "v*.*.*"
pull_request:
branches:
- "main"
env:
PLATFORM: linux/arm/v7,linux/arm64,linux/amd64
permissions:
packages: write
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
-
name: Build tags
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
-
name: Set up QEMU need for cross-platform building
uses: docker/setup-qemu-action@v3
-
name: Set up for "docker buildx"
uses: docker/setup-buildx-action@v3
-
name: Login to GitHub's container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Add README to Docker Hub
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: ammo74/cligames
short-description: "RouterOS /container with CLI games for ARM/ARM64/X86"
-
name: Build image and push image to ghcr.io
uses: docker/build-push-action@v5
with:
context: .
push: true
sbom: false
provenance: false
platforms: ${{ env.PLATFORM }}
tags: |
ghcr.io/${{ github.repository }}:latest
ammo74/cligames:latest
build-args: |
GHCR_REPO=${{ github.repository }}
GHCR_TAG=${{ steps.meta.outputs.tags }}
GHCR_PLATFORMS=${{ env.PLATFORMS }}