From: Joel Rosdahl Date: Sat, 30 Aug 2025 10:39:55 +0000 (+0200) Subject: ci: Add jobs to build and create release X-Git-Tag: v4.12~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=32109c8db415d5bdb8dec6f1cc2d0acbed029369;p=thirdparty%2Fccache.git ci: Add jobs to build and create release This includes new binary releases for Linux aarch64 and Windows aarch64. Closes #1579. See also discussion #1310. --- diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 827275d5..c151e887 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -2,6 +2,11 @@ name: Build on: push: pull_request: + workflow_dispatch: + inputs: + test_tag: + description: 'Optional tag name to simulate release' + required: false env: CTEST_OUTPUT_ON_FAILURE: ON @@ -623,6 +628,85 @@ jobs: name: ${{ matrix.name }} - testdir.tar.xz path: testdir.tar.xz + build_release: + name: Build release + needs: + - build_darwin_binary + - build_linux_aarch64_binary + - build_linux_x86_64_binary + - build_windows_binary + runs-on: ubuntu-24.04 + steps: + - name: Prepare environment + run: | + sudo apt-get update + sudo apt-get install -y minisign + + - name: Get source + uses: actions/checkout@v4 + + - name: Download binaries + uses: actions/download-artifact@v5 + with: + pattern: "*-binary" + + - name: Download docs + uses: actions/download-artifact@v5 + with: + pattern: docs + path: docs + + - name: Build release + run: ci/prepare-release + + - name: Sign release archives + if: env.MINISIGN_KEY != '' + env: + MINISIGN_KEY: ${{ secrets.MINISIGN_KEY }} + run: | + mkdir -p ~/.minisign + echo "${MINISIGN_KEY}" | base64 -d > ~/.minisign/minisign.key + minisign -Sm release/* + + - name: Upload release + uses: actions/upload-artifact@v4 + if: ${{ github.ref_type == 'tag' || github.event.inputs.test_tag != '' }} + with: + name: release + path: release + retention-days: 3 + + create_release: + name: Create release + needs: + - build_release + permissions: + contents: write + if: ${{ github.ref_type == 'tag' || github.event.inputs.test_tag != '' }} + runs-on: ubuntu-24.04 + steps: + - name: Get source + uses: actions/checkout@v4 + - name: Download release + uses: actions/download-artifact@v5 + with: + name: release + path: release + - name: Create release notes + run: | + TAG_NAME="${{ github.event.inputs.test_tag || github.ref_name }}" + ci/generate-release-notes "${TAG_NAME}" >release-notes.md + - name: Create GitHub Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + TAG_NAME="${{ github.event.inputs.test_tag || github.ref_name }}" + gh release create "${TAG_NAME}" \ + --draft \ + --notes-file release-notes.md \ + --title "${TAG_NAME}" \ + release/* + check_format: timeout-minutes: 30 name: Code formatting diff --git a/ci/generate-release-notes b/ci/generate-release-notes new file mode 100755 index 00000000..cf65acde --- /dev/null +++ b/ci/generate-release-notes @@ -0,0 +1,48 @@ +#!/bin/bash + +set -euo pipefail + +version=$(echo "$1" | sed 's/^v//') +u_version=$(echo "${version}" | sed 's/\./_/g') +url_prefix="https://github.com/ccache/ccache/releases/download/v${version}" + +source_extensions=(tar.gz tar.xz) +linux_archs=(aarch64 x86_64) +windows_archs=(aarch64 i686 x86_64) + +retcode=0 + +add() { + local descr=$1 + local file=$2 + + for f in "${file}" "${file}.minisig"; do + if [[ ! -f "${f}" ]]; then + echo "Error: ${f} does not exist" >&2 + retcode=1 + fi + done +cat <"$(DESTDIR)$(bindir)/ccache" + chmod +x "$(DESTDIR)$(bindir)/ccache" + + mkdir -p "$(DESTDIR)$(docdir)" + cp $(doc_files) "$(DESTDIR)$(docdir)" + + mkdir -p "$(DESTDIR)$(man1dir)" + cp ccache.1 "$(DESTDIR)$(man1dir)"