diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 2aa850678..bff565e00 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -19,6 +19,7 @@ jobs: runs-on: ubuntu-24.04 outputs: run: ${{ steps.filter.outputs.run }} + skip-publishing: ${{ steps.publishing.outputs.skip }} tests: ${{ steps.tests.outputs.output }} steps: - uses: envoyproxy/toolshed/actions/github/should-run@5171ddd579f53dcef432bc54e16e2d2c90864968 # actions-v0.4.13 @@ -29,6 +30,38 @@ jobs: - 'actions/**' - 'js/**' - '.github/workflows/actions.yml' + - name: Detect cross-stack publish + id: publishing + if: github.event_name == 'push' + shell: bash + run: | + is_non_dev() { + local file="$1" + local version + version="$(tr -d '[:space:]' < "$file")" + [[ "$version" != *-dev ]] + } + + self_publishing=false + others_publishing=false + + if is_non_dev actions/VERSION.txt; then + self_publishing=true + fi + + for file in bazel/VERSION.txt BINS_VERSION.txt docker/build/VERSION.txt py/VERSION.txt; do + if is_non_dev "$file"; then + others_publishing=true + break + fi + done + + if [[ "$others_publishing" == "true" && "$self_publishing" == "false" ]]; then + echo "skip=true" >> "$GITHUB_OUTPUT" + echo "Other stack(s) publishing - skipping heavy jobs" + else + echo "skip=false" >> "$GITHUB_OUTPUT" + fi - id: tests uses: envoyproxy/toolshed/actions/bson@5171ddd579f53dcef432bc54e16e2d2c90864968 # actions-v0.4.13 with: @@ -45,6 +78,7 @@ jobs: needs: request if: >- fromJSON(needs.request.outputs.run) + && needs.request.outputs.skip-publishing != 'true' && needs.request.outputs.tests != '[]' strategy: fail-fast: false diff --git a/.github/workflows/bazel.yml b/.github/workflows/bazel.yml index 1d81d386d..04ae9c137 100644 --- a/.github/workflows/bazel.yml +++ b/.github/workflows/bazel.yml @@ -19,6 +19,7 @@ jobs: runs-on: ubuntu-24.04 outputs: run: ${{ steps.filter.outputs.run }} + skip-publishing: ${{ steps.publishing.outputs.skip }} steps: - uses: envoyproxy/toolshed/actions/github/should-run@5171ddd579f53dcef432bc54e16e2d2c90864968 # actions-v0.4.13 id: filter @@ -30,6 +31,38 @@ jobs: - bazel/** - .github/workflows/bazel.yml - .github/workflows/_bazel.yml + - name: Detect cross-stack publish + id: publishing + if: github.event_name == 'push' + shell: bash + run: | + is_non_dev() { + local file="$1" + local version + version="$(tr -d '[:space:]' < "$file")" + [[ "$version" != *-dev ]] + } + + self_publishing=false + others_publishing=false + + if is_non_dev bazel/VERSION.txt || is_non_dev BINS_VERSION.txt; then + self_publishing=true + fi + + for file in actions/VERSION.txt docker/build/VERSION.txt py/VERSION.txt; do + if is_non_dev "$file"; then + others_publishing=true + break + fi + done + + if [[ "$others_publishing" == "true" && "$self_publishing" == "false" ]]; then + echo "skip=true" >> "$GITHUB_OUTPUT" + echo "Other stack(s) publishing - skipping heavy jobs" + else + echo "skip=false" >> "$GITHUB_OUTPUT" + fi test: permissions: @@ -39,6 +72,7 @@ jobs: if: >- always() && fromJSON(needs.request.outputs.run || 'false') + && needs.request.outputs.skip-publishing != 'true' uses: ./.github/workflows/_bazel.yml with: action: test @@ -68,6 +102,7 @@ jobs: if: >- always() && fromJSON(needs.request.outputs.run || 'false') + && needs.request.outputs.skip-publishing != 'true' uses: ./.github/workflows/_bazel.yml with: action: build @@ -104,6 +139,7 @@ jobs: if: >- always() && fromJSON(needs.request.outputs.run || 'false') + && needs.request.outputs.skip-publishing != 'true' uses: ./.github/workflows/_bazel.yml with: action: build @@ -134,6 +170,7 @@ jobs: if: >- always() && fromJSON(needs.request.outputs.run || 'false') + && needs.request.outputs.skip-publishing != 'true' strategy: fail-fast: false matrix: diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index e723633fa..f8c1786d8 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -20,6 +20,7 @@ jobs: runs-on: ubuntu-24.04 outputs: run: ${{ steps.filter.outputs.run }} + skip-publishing: ${{ steps.publishing.outputs.skip }} steps: - uses: envoyproxy/toolshed/actions/github/should-run@5171ddd579f53dcef432bc54e16e2d2c90864968 # actions-v0.4.13 id: filter @@ -30,6 +31,38 @@ jobs: - '.github/workflows/docker.yml' - '.github/docker-manifests.yml' - 'docker/build/VERSION.txt' + - name: Detect cross-stack publish + id: publishing + if: github.event_name == 'push' + shell: bash + run: | + is_non_dev() { + local file="$1" + local version + version="$(tr -d '[:space:]' < "$file")" + [[ "$version" != *-dev ]] + } + + self_publishing=false + others_publishing=false + + if is_non_dev docker/build/VERSION.txt; then + self_publishing=true + fi + + for file in actions/VERSION.txt bazel/VERSION.txt BINS_VERSION.txt py/VERSION.txt; do + if is_non_dev "$file"; then + others_publishing=true + break + fi + done + + if [[ "$others_publishing" == "true" && "$self_publishing" == "false" ]]; then + echo "skip=true" >> "$GITHUB_OUTPUT" + echo "Other stack(s) publishing - skipping heavy jobs" + else + echo "skip=false" >> "$GITHUB_OUTPUT" + fi build: runs-on: ${{ matrix.arch == 'amd64' && 'ubuntu-24.04' || 'ubuntu-24.04-arm' }} @@ -37,6 +70,7 @@ jobs: if: >- github.repository_owner == 'envoyproxy' && fromJSON(needs.request.outputs.run || 'false') + && needs.request.outputs.skip-publishing != 'true' strategy: fail-fast: false matrix: diff --git a/.github/workflows/py.yml b/.github/workflows/py.yml index 2c9fde2a1..bffa9820e 100644 --- a/.github/workflows/py.yml +++ b/.github/workflows/py.yml @@ -21,6 +21,7 @@ jobs: runs-on: ubuntu-24.04 outputs: run: ${{ steps.filter.outputs.run }} + skip-publishing: ${{ steps.publishing.outputs.skip }} steps: - uses: envoyproxy/toolshed/actions/github/should-run@5171ddd579f53dcef432bc54e16e2d2c90864968 # actions-v0.4.13 id: filter @@ -37,6 +38,38 @@ jobs: - 'mypy.ini' - 'pytest.ini' - 'py/**' + - name: Detect cross-stack publish + id: publishing + if: github.event_name == 'push' + shell: bash + run: | + is_non_dev() { + local file="$1" + local version + version="$(tr -d '[:space:]' < "$file")" + [[ "$version" != *-dev ]] + } + + self_publishing=false + others_publishing=false + + if is_non_dev py/VERSION.txt; then + self_publishing=true + fi + + for file in actions/VERSION.txt bazel/VERSION.txt BINS_VERSION.txt docker/build/VERSION.txt; do + if is_non_dev "$file"; then + others_publishing=true + break + fi + done + + if [[ "$others_publishing" == "true" && "$self_publishing" == "false" ]]; then + echo "skip=true" >> "$GITHUB_OUTPUT" + echo "Other stack(s) publishing - skipping heavy jobs" + else + echo "skip=false" >> "$GITHUB_OUTPUT" + fi test: runs-on: ubuntu-24.04 @@ -44,6 +77,7 @@ jobs: if: >- github.repository_owner == 'envoyproxy' && fromJSON(needs.request.outputs.run) + && needs.request.outputs.skip-publishing != 'true' steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 @@ -67,6 +101,7 @@ jobs: needs: request if: >- fromJSON(needs.request.outputs.run) + && needs.request.outputs.skip-publishing != 'true' steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 @@ -85,6 +120,7 @@ jobs: needs: request if: >- fromJSON(needs.request.outputs.run) + && needs.request.outputs.skip-publishing != 'true' steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 @@ -124,6 +160,7 @@ jobs: # - docs if: >- fromJSON(needs.request.outputs.run) + && needs.request.outputs.skip-publishing != 'true' steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index db23b2ead..f6785bb4e 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -20,6 +20,7 @@ jobs: runs-on: ubuntu-24.04 outputs: run: ${{ steps.filter.outputs.run }} + skip-publishing: ${{ steps.publishing.outputs.skip }} steps: - uses: envoyproxy/toolshed/actions/github/should-run@5171ddd579f53dcef432bc54e16e2d2c90864968 # actions-v0.4.13 id: filter @@ -29,6 +30,38 @@ jobs: - BINS_VERSION.txt - 'rust/**' - '.github/workflows/rust.yml' + - name: Detect cross-stack publish + id: publishing + if: github.event_name == 'push' + shell: bash + run: | + is_non_dev() { + local file="$1" + local version + version="$(tr -d '[:space:]' < "$file")" + [[ "$version" != *-dev ]] + } + + self_publishing=false + others_publishing=false + + if is_non_dev BINS_VERSION.txt; then + self_publishing=true + fi + + for file in actions/VERSION.txt bazel/VERSION.txt docker/build/VERSION.txt py/VERSION.txt; do + if is_non_dev "$file"; then + others_publishing=true + break + fi + done + + if [[ "$others_publishing" == "true" && "$self_publishing" == "false" ]]; then + echo "skip=true" >> "$GITHUB_OUTPUT" + echo "Other stack(s) publishing - skipping heavy jobs" + else + echo "skip=false" >> "$GITHUB_OUTPUT" + fi test: runs-on: ubuntu-24.04 @@ -36,6 +69,7 @@ jobs: if: >- github.repository_owner == 'envoyproxy' && fromJSON(needs.request.outputs.run || 'false') + && needs.request.outputs.skip-publishing != 'true' strategy: fail-fast: false matrix: @@ -70,6 +104,7 @@ jobs: if: >- always() && fromJSON(needs.request.outputs.run || 'false') + && needs.request.outputs.skip-publishing != 'true' runs-on: ${{ matrix.runs-on }} strategy: matrix: