From fee18678afd3bfee7fbd899b838a6b6ac852e05f Mon Sep 17 00:00:00 2001 From: Leynos Date: Fri, 26 Dec 2025 14:07:12 +0000 Subject: [PATCH] feat(ci): add release dry run workflow for pull requests - Add a new workflow `release-dry-run.yml` triggered on pull requests to perform dry-run releases. - Update `release.yml` to support a dry-run mode that builds and packages without uploading artifacts or creating a GitHub release. - Allow the main release workflow to be called with a `dry-run` input to enable testing release process without side effects. Co-authored-by: terragon-labs[bot] --- .github/workflows/release-dry-run.yml | 13 +++++++++++++ .github/workflows/release.yml | 24 ++++++++++++++++++++---- 2 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/release-dry-run.yml diff --git a/.github/workflows/release-dry-run.yml b/.github/workflows/release-dry-run.yml new file mode 100644 index 0000000..80d3c55 --- /dev/null +++ b/.github/workflows/release-dry-run.yml @@ -0,0 +1,13 @@ +--- +name: Release Dry Run + +'on': + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + +jobs: + release: + uses: ./.github/workflows/release.yml + with: + dry-run: true + secrets: inherit diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c26c4eb..c18e46b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,9 +1,19 @@ +--- name: Release -on: +'on': push: tags: - 'v*.*.*' + workflow_call: + inputs: + dry-run: + description: >- + When true, build and package without uploading artefacts or creating + a release. + required: false + type: boolean + default: false jobs: build-packages: @@ -35,19 +45,23 @@ jobs: - name: Prepare release version run: | set -euo pipefail - version="${GITHUB_REF_NAME#v}" + if [[ "$GITHUB_REF_NAME" =~ ^v[0-9]+\.[0-9]+\.[0-9]+ ]]; then + version="${GITHUB_REF_NAME#v}" + else + version="0.0.0-dev" + fi echo "RELEASE_VERSION=${version}" >> "$GITHUB_ENV" - name: Clean dist directory run: rm -rf dist - name: Build ${{ matrix.bin }} - uses: leynos/shared-actions/.github/actions/rust-build-release@1479e2ffbbf1053bb0205357dfe965299b7493ed + uses: leynos/shared-actions/.github/actions/rust-build-release@b3b75715b965ec6c09984a3cea6a725a17bd4107 with: target: ${{ matrix.target }} bin-name: ${{ matrix.bin }} version: ${{ env.RELEASE_VERSION }} formats: deb,rpm - name: Package ${{ matrix.bin }} - uses: leynos/shared-actions/.github/actions/linux-packages@1479e2ffbbf1053bb0205357dfe965299b7493ed + uses: leynos/shared-actions/.github/actions/linux-packages@b3b75715b965ec6c09984a3cea6a725a17bd4107 with: bin-name: ${{ matrix.bin }} package-name: ${{ matrix.bin }} @@ -58,6 +72,7 @@ jobs: deb-depends: ${{ env.PACKAGE_DEB_DEPENDS }} rpm-depends: ${{ env.PACKAGE_RPM_DEPENDS }} - name: Upload artefacts + if: ${{ !inputs.dry-run }} uses: actions/upload-artifact@v4 with: name: ${{ matrix.bin }}-${{ matrix.arch }} @@ -68,6 +83,7 @@ jobs: dist/.man/** if-no-files-found: error release: + if: ${{ !inputs.dry-run }} name: Publish GitHub release runs-on: ubuntu-latest needs: build-packages