mirror of
https://github.com/bgp/bgpq4.git
synced 2024-05-11 05:55:05 +00:00
66 lines
1.7 KiB
YAML
66 lines
1.7 KiB
YAML
name: Container build
|
|
"on":
|
|
push:
|
|
tags:
|
|
- "*" # Push events to any tag
|
|
branches:
|
|
- "main"
|
|
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: "Container tag to use for the build"
|
|
required: true
|
|
default: "test"
|
|
|
|
jobs:
|
|
test:
|
|
uses: ./.github/workflows/unit-tests.yml
|
|
|
|
build:
|
|
name: Build container
|
|
runs-on: ubuntu-22.04
|
|
needs: test
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- # Add support for more platforms with QEMU
|
|
# https://github.com/docker/setup-qemu-action
|
|
name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ghcr.io/${{ github.repository_owner }}/bgpq4
|
|
tags: |
|
|
# pick up tag provided from workflow_dispatch user's input
|
|
type=raw,value=${{ inputs.tag }}
|
|
type=ref,event=tag
|
|
type=ref,event=branch
|
|
# git short commit
|
|
type=sha
|
|
|
|
- name: Login to GitHub Container Registry
|
|
if: github.repository_owner == 'bgp'
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
file: .github/images/alpine:3.Dockerfile
|
|
context: .
|
|
platforms: linux/amd64,linux/arm64
|
|
push: ${{ github.repository_owner == 'bgp' }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|