From 51a2e49dd667b8cc6df996ece70f0552e3edc686 Mon Sep 17 00:00:00 2001 From: Paulo Rego <832830+paulovmr@users.noreply.github.com> Date: Wed, 30 Oct 2024 10:09:22 -0300 Subject: [PATCH] RHOAIENG-15020: Add a dry mode option to the Release workflow (#79) --- .../{release.yml => release_build.yml} | 17 +++++--- .github/workflows/release_dry_run.yml | 41 +++++++++++++++++++ .github/workflows/release_publish.yml | 33 +++++++++++++++ 3 files changed, 86 insertions(+), 5 deletions(-) rename .github/workflows/{release.yml => release_build.yml} (84%) create mode 100644 .github/workflows/release_dry_run.yml create mode 100644 .github/workflows/release_publish.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release_build.yml similarity index 84% rename from .github/workflows/release.yml rename to .github/workflows/release_build.yml index 89e9c0b69..6b2317e28 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release_build.yml @@ -13,12 +13,16 @@ # See the License for the specific language governing permissions and # limitations under the License. # -name: Elyra Build and Release +name: Elyra Release - Build on: - push: - tags: - - v* - workflow_dispatch: + workflow_call: + inputs: + dry_run: + type: boolean + required: true + base_ref: + type: string + required: true env: FORCE_COLOR: true @@ -37,6 +41,7 @@ jobs: - name: Check out the repository uses: actions/checkout@v4 with: + ref: ${{ inputs.base_ref }} fetch-depth: 0 - name: Set up Python uses: actions/setup-python@v5 @@ -52,6 +57,7 @@ jobs: yarn set version ${{ env.YARN_VERSION }} yarn --version - name: Check version + if: ${{ !inputs.dry_run && github.repository_owner == 'opendatahub-io' }} run: | set -o pipefail LATEST_TAG=$(git describe --tags --match="v*") @@ -64,6 +70,7 @@ jobs: run: | make install-prod - name: Publish package on PyPI + if: ${{ !inputs.dry_run && github.repository_owner == 'opendatahub-io' }} uses: pypa/gh-action-pypi-publish@release/v1 with: verbose: true diff --git a/.github/workflows/release_dry_run.yml b/.github/workflows/release_dry_run.yml new file mode 100644 index 000000000..483859bd9 --- /dev/null +++ b/.github/workflows/release_dry_run.yml @@ -0,0 +1,41 @@ +# +# Copyright 2018-2023 Elyra Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +name: Elyra Release - Dry Run +on: + workflow_dispatch: + inputs: + tag: + type: string + required: true + description: "Tag or branch associated with the release" + default: "main" + schedule: + - cron: "0 4 * * *" # 4am UTC everyday + pull_request: + branches: ["**"] + paths: + - ".github/workflows/release*" + +concurrency: + group: ${{ github.event.pull_request && format('release-dry-run-pr-{0}', github.event.pull_request.number) || format('release-dry-run-ref-{0}', github.ref_name) }} + cancel-in-progress: true + +jobs: + dry_run: + uses: ./.github/workflows/release_build.yml + with: + dry_run: true + base_ref: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref }} \ No newline at end of file diff --git a/.github/workflows/release_publish.yml b/.github/workflows/release_publish.yml new file mode 100644 index 000000000..19b1fc08d --- /dev/null +++ b/.github/workflows/release_publish.yml @@ -0,0 +1,33 @@ +# +# Copyright 2018-2023 Elyra Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +name: Elyra Release - Publish +on: + push: + tags: + - v* + workflow_dispatch: + inputs: + tag: + type: string + required: true + description: "Tag associated with the release (e.g.: v4.0.0)" + +jobs: + release: + uses: ./.github/workflows/release_build.yml + with: + dry_run: false + base_ref: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref }}