From 5c80e71448de77e9b6f8e595d32528622520fc23 Mon Sep 17 00:00:00 2001 From: IhsenBouallegue Date: Thu, 12 Dec 2024 12:28:33 +0100 Subject: [PATCH] feat(config): add comprehensive prepare release workflow for visualization and analysis --- .../{release.yml => prepare-release.yml} | 36 ++++++++++++++----- .github/workflows/release-analysis.yml | 6 +--- .github/workflows/release-visualization.yml | 6 +--- 3 files changed, 29 insertions(+), 19 deletions(-) rename .github/workflows/{release.yml => prepare-release.yml} (53%) diff --git a/.github/workflows/release.yml b/.github/workflows/prepare-release.yml similarity index 53% rename from .github/workflows/release.yml rename to .github/workflows/prepare-release.yml index 9d0863f36a..291b79378c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/prepare-release.yml @@ -1,4 +1,4 @@ -name: Prepare Release (Visualization/Analysis) +name: Prepare Release - Visualization/Analysis on: workflow_dispatch: @@ -27,6 +27,7 @@ jobs: prefix: ${{ steps.version.outputs.prefix }} permissions: contents: write + pull-requests: write steps: - name: Checkout uses: actions/checkout@v4 @@ -46,18 +47,35 @@ jobs: echo "new_version=${NEW_VERSION}" >> $GITHUB_OUTPUT echo "prefix=${{ inputs.repository == 'Visualization' && 'vis' || 'ana' }}" >> $GITHUB_OUTPUT - - name: Commit and tag changes + - name: Create release branch and commit changes run: | + # Create a new branch + git checkout -b release/${{ steps.version.outputs.prefix }}-${{ steps.version.outputs.new_version }} + + # Stage and commit changes git config --local user.email "action@github.com" git config --local user.name "GitHub Action" git add -A git commit -m "Releasing ${{ steps.version.outputs.prefix }}-${{ steps.version.outputs.new_version }} [skip ci]" + + # Create tag (will be pushed with the merge) git tag "${{ steps.version.outputs.prefix }}-${{ steps.version.outputs.new_version }}" - git push --follow-tags + + # Push branch + git push origin release/${{ steps.version.outputs.prefix }}-${{ steps.version.outputs.new_version }} - - name: Trigger release workflow - run: | - gh workflow run "Release ${{ inputs.repository }}" \ - --ref "${{ steps.version.outputs.prefix }}-${{ steps.version.outputs.new_version }}" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + - name: Create release pull request + uses: peter-evans/create-pull-request@v5 + with: + title: "Release ${{ inputs.repository }} ${{ steps.version.outputs.new_version }}" + body: | + Automated PR for releasing ${{ inputs.repository }} version ${{ steps.version.outputs.new_version }} + + This PR was automatically created by the release workflow. + After merging, the tag `${{ steps.version.outputs.prefix }}-${{ steps.version.outputs.new_version }}` will trigger the release workflow. + branch: release/${{ steps.version.outputs.prefix }}-${{ steps.version.outputs.new_version }} + base: main + labels: release + delete-branch: true + + # The appropriate release workflow will be triggered after the PR is merged diff --git a/.github/workflows/release-analysis.yml b/.github/workflows/release-analysis.yml index 34c9ddd80b..2313f58228 100644 --- a/.github/workflows/release-analysis.yml +++ b/.github/workflows/release-analysis.yml @@ -1,10 +1,6 @@ -# WARNING: Do not change the name of this workflow as it is referenced by the release.yml workflow -name: Release Analysis +name: Release - Analysis on: - workflow_dispatch: - # This workflow is triggered by the release.yml workflow after version updates - # The tag-based trigger is kept for backward compatibility push: tags: 'ana-*.*.*' diff --git a/.github/workflows/release-visualization.yml b/.github/workflows/release-visualization.yml index 582b4214c1..c6f9510261 100644 --- a/.github/workflows/release-visualization.yml +++ b/.github/workflows/release-visualization.yml @@ -1,10 +1,6 @@ -# WARNING: Do not change the name of this workflow as it is referenced by the release.yml workflow -name: Release Visualization +name: Release - Visualization on: - workflow_dispatch: - # This workflow is triggered by the release.yml workflow after version updates - # The tag-based trigger is kept for backward compatibility push: tags: 'vis-*.*.*'