1
0
mirror of https://github.com/craigerl/aprsd.git synced 2026-01-21 04:55:38 -05:00
aprsd/.github/workflows/manual_build.yml

72 lines
2.0 KiB
YAML

name: Manual Build docker container
on:
workflow_dispatch:
inputs:
ref:
description: 'Tag or branch to build (e.g. 4.2.4, v4.2.4, master). Empty = use "Use workflow from" selection.'
required: false
type: string
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Resolve ref
id: ref
run: |
#!/bin/bash
input_ref='${{ inputs.ref }}'
github_ref='${{ github.ref }}'
# Decide which ref to use
if [ -n "$input_ref" ]; then
ref_to_use="$input_ref"
echo "Using input ref: $input_ref"
else
ref_to_use="$github_ref"
echo "Using github.ref: $github_ref"
fi
# Strip refs/tags/ or refs/heads/ if present
clean_ref="${ref_to_use##refs/tags/}"
clean_ref="${clean_ref##refs/heads/}"
echo "After stripping: $clean_ref"
echo "name=${clean_ref}" >> "$GITHUB_OUTPUT"
echo "Wrote output: name=${clean_ref}"
- name: Build ref
run: echo "Building '${{ steps.ref.outputs.name }}'"
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker HUB
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build the Docker image
uses: docker/build-push-action@v6
with:
context: ./docker
platforms: linux/amd64,linux/arm64
file: ./docker/Dockerfile
build-args: |
INSTALL_TYPE=github
BRANCH=${{ steps.ref.outputs.name }}
BUILDX_QEMU_ENV=true
push: true
tags: |
hemna6969/aprsd:${{ steps.ref.outputs.name }}