From 6a6a6b16402ca44ca312f20ef5bb9b876c3b83c1 Mon Sep 17 00:00:00 2001 From: AJ Schmidt Date: Thu, 14 Dec 2023 09:58:11 -0500 Subject: [PATCH] ci: Ensure `ci-imgs` repo is only triggered when new releases occur (#63) The `release.yaml` workflow currently triggers the `ci-imgs` repository to rebuild anytime a merge to `main` happens. This PR makes the logic smarter by only triggering the `ci-imgs` repository to rebuild when an actual release occurs. This will prevent `ci-imgs` rebuilds from occurring unnecessarily. --- .github/workflows/release.yaml | 4 ++++ .releaserc.yaml | 1 + ci/semantic-release-success.sh | 4 ++++ 3 files changed, 9 insertions(+) create mode 100755 ci/semantic-release-success.sh diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 7b2dcb7d..880d0f5e 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -8,6 +8,8 @@ on: jobs: release: runs-on: ubuntu-latest + outputs: + RELEASE_PUBLISHED: ${{ steps.semantic-release.outputs.RELEASE_PUBLISHED }} permissions: contents: write # to be able to publish a GitHub release issues: write # to be able to comment on released issues @@ -24,6 +26,7 @@ jobs: with: node-version: "lts/*" - name: Release + id: semantic-release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PYPI_TOKEN: ${{ secrets.RAPIDSAI_PYPI_TOKEN }} @@ -31,6 +34,7 @@ jobs: npm install npx semantic-release trigger-pipeline: + if: needs.release.outputs.RELEASE_PUBLISHED == 'true' runs-on: ubuntu-latest needs: release steps: diff --git a/.releaserc.yaml b/.releaserc.yaml index 4c9cb35f..81184e0e 100644 --- a/.releaserc.yaml +++ b/.releaserc.yaml @@ -8,6 +8,7 @@ plugins: - - "@semantic-release/exec" - verifyReleaseCmd: ./ci/update-versions.sh ${nextRelease.version} && ./ci/build-test.sh publishCmd: ./ci/pypi-publish.sh + successCmd: ./ci/semantic-release-success.sh - - "@semantic-release/git" - assets: - src/rapids_dependency_file_generator/_version.py diff --git a/ci/semantic-release-success.sh b/ci/semantic-release-success.sh new file mode 100755 index 00000000..26847f50 --- /dev/null +++ b/ci/semantic-release-success.sh @@ -0,0 +1,4 @@ +#!/bin/bash +set -euo pipefail + +echo "RELEASE_PUBLISHED=true" | tee --append "${GITHUB_OUTPUT:-/dev/null}"