From 7c5cd40f6b944e95abbace3350f45ea1095fde82 Mon Sep 17 00:00:00 2001 From: tsukumi Date: Mon, 5 Jan 2026 22:45:02 +0900 Subject: [PATCH] CI: Allow workflow_dispatch builds/releases for a specific commit SHA; include commit date and short hash in release tag --- .github/workflows/Dockerfile | 41 ------------------------- .github/workflows/build_and_release.yml | 28 ++++++++++++----- 2 files changed, 20 insertions(+), 49 deletions(-) delete mode 100644 .github/workflows/Dockerfile diff --git a/.github/workflows/Dockerfile b/.github/workflows/Dockerfile deleted file mode 100644 index 6057297..0000000 --- a/.github/workflows/Dockerfile +++ /dev/null @@ -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/ diff --git a/.github/workflows/build_and_release.yml b/.github/workflows/build_and_release.yml index a7a1287..3d39dbd 100644 --- a/.github/workflows/build_and_release.yml +++ b/.github/workflows/build_and_release.yml @@ -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