Define runner based on platform #484
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Container | |
on: | |
push: | |
paths-ignore: | |
- '.devcontainer/**' | |
- 'examples/**' | |
- 'lib/**' | |
- 'man/**' | |
- 'priv/**' | |
- '**.md' | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
container: | |
name: Container | |
runs-on: ${{ matrix.runner }} | |
strategy: | |
matrix: | |
platform: [amd64, arm64] | |
include: | |
- platform: amd64 | |
runner: ubuntu-22.04 | |
- platform: arm64 | |
runner: ubuntu-22.04-arm | |
permissions: | |
packages: write | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Checkout ejabberd-contrib | |
uses: actions/checkout@v4 | |
with: | |
repository: processone/ejabberd-contrib | |
path: .ejabberd-modules/sources/ejabberd-contrib | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get git describe | |
id: gitdescribe | |
run: echo "ver=$(git describe --tags)" >> $GITHUB_OUTPUT | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
labels: | | |
org.opencontainers.image.revision=${{ steps.gitdescribe.outputs.ver }} | |
org.opencontainers.image.licenses=GPL-2.0 | |
org.opencontainers.image.vendor=ProcessOne | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
build-args: | | |
VERSION=${{ steps.gitdescribe.outputs.ver }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
context: . | |
file: .github/container/Dockerfile | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: linux/${{ matrix.platform }} | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} |