CI: Allow workflow_dispatch builds/releases for a specific commit SHA; include commit date and short hash in release tag

This commit is contained in:
tsukumi 2026-01-05 22:45:02 +09:00
parent d610b90235
commit 7c5cd40f6b
2 changed files with 20 additions and 49 deletions

View file

@ -1,41 +0,0 @@
ARG IMAGE
FROM ${IMAGE}
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y software-properties-common && \
add-apt-repository -y ppa:ubuntu-support-team/meson
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
debhelper \
devscripts \
meson \
pkg-config \
libstdc++6 \
libgbm-dev \
libdrm-dev \
libx11-6 \
libx11-dev \
libx11-xcb1 \
libx11-xcb-dev \
libxcb-dri2-0 \
libxcb-dri2-0-dev \
libxcb-dri3-dev \
libxcb-present-dev \
libxcb-xfixes0-dev \
libxdamage1 \
libxdamage-dev \
libxext6 \
libxext-dev \
libxfixes3 \
libxfixes-dev \
libwayland-client0 \
libwayland-dev \
&& apt-get clean autoclean --yes \
&& apt-get autoremove --yes \
&& rm -rf /var/cache/apt/archives* /var/lib/apt/lists/*
COPY . /src/
WORKDIR /src/

View file

@ -5,16 +5,27 @@ on:
branches:
- master
workflow_dispatch:
inputs:
commit_sha:
description: 'Target commit SHA to build (full SHA recommended).'
required: true
type: string
jobs:
build_and_release:
build-and-release:
name: Build and Release Debian Package
# Run on arm64 hosted runner to avoid QEMU emulation slowness.
runs-on: ubuntu-22.04-arm
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.commit_sha || github.sha }}
- name: Fix Git Permissions
run: |
mkdir -p ~/.config/git
@ -56,9 +67,6 @@ jobs:
sudo apt-get autoremove --yes
sudo rm -rf /var/cache/apt/archives* /var/lib/apt/lists/*
- name: Checkout repository
uses: actions/checkout@v4
- name: Build Debian package
run: |
debuild -us -uc -b && cp -a ../*.deb ./
@ -68,15 +76,19 @@ jobs:
run: |
echo "version=$(dpkg-parsechangelog --show-field Version)" >> $GITHUB_OUTPUT
- name: Get commit hash
- name: Get commit metadata
id: get_commit_hash
uses: prompt/actions-commit-hash@v3
run: |
echo "date=$(git show -s --format=%cd --date=format:%Y%m%d HEAD)" >> $GITHUB_OUTPUT
echo "full=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
echo "short=$(git rev-parse --short=7 HEAD)" >> $GITHUB_OUTPUT
- name: Release
uses: softprops/action-gh-release@v1
with:
name: v${{ steps.get_version.outputs.version }}-${{ steps.get_commit_hash.outputs.short }}
tag_name: v${{ steps.get_version.outputs.version }}-${{ steps.get_commit_hash.outputs.short }}
name: v${{ steps.get_version.outputs.version }}-${{ steps.get_commit_hash.outputs.date }}-${{ steps.get_commit_hash.outputs.short }}
tag_name: v${{ steps.get_version.outputs.version }}-${{ steps.get_commit_hash.outputs.date }}-${{ steps.get_commit_hash.outputs.short }}
target_commitish: ${{ steps.get_commit_hash.outputs.full }}
generate_release_notes: true
files: |
./*.deb