From 9496d05cd290f17921217141d45f65f2830e5851 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 26 Jun 2025 22:27:30 +0000 Subject: [PATCH] ci: Pass package build condition as workflow arg. ci: Add defaults for init matrix; branch conditions for pulls. Signed-off-by: Jason Volk --- .github/workflows/main.yml | 14 ++++++++++---- .github/workflows/package.yml | 5 ++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 31d8fbcb..474f0ef4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,18 +38,21 @@ jobs: sys_targets: ${{vars.SYS_TARGETS || env.default_sys_targets}} sys_versions: ${{vars.SYS_VERSIONS || env.default_sys_versions}} machines: ${{vars.MACHINES || env.default_machines}} - release_url: ${{steps.release.outputs.upload_url}} + package: ${{vars.PACKAGE || !contains(github.ref, 'refs/pull/')}} + publish: ${{vars.PUBLISH || !contains(github.ref, 'refs/pull/')}} + build_pkgs: ${{vars.BUILD_PKGS || github.ref == 'refs/heads/main' || contains(github.ref, 'tags/v')}} check_pkgs: ${{vars.CHECK_PKGS || 'false'}} complement: ${{vars.COMPLEMENT || 'true'}} complement_runner: 'het' docker_repo: ${{vars.DOCKER_REPO}} + release_url: ${{steps.release.outputs.upload_url}} strategy: fail-fast: true matrix: - runner: ${{fromJSON(vars.RUNNERS)}} - machine: ${{fromJSON(vars.MACHINES)}} - exclude: ${{fromJSON(vars.RUNNERS_EXCLUDES)}} + runner: ${{fromJSON(vars.RUNNERS || '["het"]')}} + machine: ${{fromJSON(vars.MACHINES || '["X64"]')}} + exclude: ${{fromJSON(vars.RUNNERS_EXCLUDES || '[]')}} steps: - name: Initialize Builder @@ -202,6 +205,7 @@ jobs: package: if: > !failure() && !cancelled() + && needs.init.outputs.package name: Package needs: [init, lint] @@ -209,6 +213,7 @@ jobs: with: release_url: ${{needs.init.outputs.release_url}} check_pkgs: ${{needs.init.outputs.check_pkgs}} + build_pkgs: ${{needs.init.outputs.build_pkgs}} cargo_profiles: ${{needs.init.outputs.cargo_profiles}} feat_sets: ${{needs.init.outputs.feat_sets}} rust_toolchains: ${{needs.init.outputs.rust_toolchains}} @@ -249,6 +254,7 @@ jobs: publish: if: > !failure() && !cancelled() + && needs.init.outputs.publish name: Publish needs: [init, test, package] diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index bff0c1ba..330a9bf6 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -38,6 +38,9 @@ on: release_url: type: string description: For release assets + build_pkgs: + type: string + default: 'true' check_pkgs: type: string default: 'false' @@ -147,7 +150,7 @@ jobs: && contains(fromJSON(inputs.feat_sets), fromJSON('["all"]')[0]) && contains(fromJSON(inputs.cargo_profiles), fromJSON('["release"]')[0]) && contains(fromJSON(inputs.rust_toolchains), fromJSON('["stable"]')[0]) - && (github.ref == 'refs/heads/main' || contains(github.ref, 'refs/tags/v')) + && fromJSON(inputs.build_pkgs) name: Distro Packages uses: ./.github/workflows/bake.yml