From 587469a005f57f4f21689f8000909562b06bfca4 Mon Sep 17 00:00:00 2001 From: Chuck Grindel Date: Tue, 12 Dec 2023 08:58:47 -0700 Subject: [PATCH] chore: add workflow to move the major version tag --- .../move_major_ver_tag_on_release.yml | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/move_major_ver_tag_on_release.yml diff --git a/.github/workflows/move_major_ver_tag_on_release.yml b/.github/workflows/move_major_ver_tag_on_release.yml new file mode 100644 index 0000000..3712b65 --- /dev/null +++ b/.github/workflows/move_major_ver_tag_on_release.yml @@ -0,0 +1,43 @@ +name: Move Major Version Tag on Release + +on: + release: + types: [ published ] + workflow_dispatch: + inputs: + release_tag: + required: true + type: string + +jobs: + move_major_version_tag: + runs-on: ubuntu-latest + steps: + + # Checks out the code from your repository with all history for all + # branches and tags. This is important if the workflow is launched via + # workspace_dispatch event. It ensures that we can find the release tag + # and the major version tag. + - uses: actions/checkout@v4 + with: + # Fetch all history for all branches and tags + fetch-depth: 0 + + # Configures the git user config. This is necessary when making changes + # to a git repository. + - uses: cgrindel/gha_configure_git_user@v1 + + # The release tag can come into the workflow via the release event or as + # a workflow_dispatch event. This step finds the first non-empty value + # and outputs it as `selected_value`. + - name: Resolve release_tag + id: resolve_release_tag + uses: cgrindel/gha_select_value@v1 + with: + value0: ${{ github.event.release.tag_name }} + value1: ${{ github.event.inputs.release_tag }} + + # Create or move the major version tag + - uses: cgrindel/gha_move_major_version_tag@v1 + with: + release_tag: ${{ steps.resolve_release_tag.outputs.selected_value }}