| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you 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. |
| |
| # This workflow will choose a commit to be the basis of a release candidate |
| ## and push a new tagged commit for that RC. |
| |
| # To learn more about GitHub Actions in Apache Beam check the CI.md |
| |
| name: Choose RC Commit |
| on: |
| workflow_dispatch: |
| inputs: |
| RELEASE: |
| description: Beam version of current release (e.g. 2.XX.0) |
| required: true |
| RC: |
| description: Integer RC version for the release (e.g. 3 for RC3) |
| required: true |
| COMMIT: |
| description: Selected commit to create the release (should be full commit sha) |
| required: true |
| PUSH_TAG: |
| description: Push tag (yes/no) |
| required: false |
| default: no |
| OVERWRITE: |
| description: Overwrite RC Tag (yes/no) |
| required: false |
| default: no |
| DEBUG: |
| description: Debug enabled (yes/no) |
| required: false |
| default: no |
| |
| jobs: |
| choose_rc_commit: |
| runs-on: [self-hosted, ubuntu-20.04] |
| env: |
| RC_TAG: v${{ github.event.inputs.RELEASE }}-RC${{ github.event.inputs.RC }} |
| SCRIPT_DIR: ./release/src/main/scripts |
| DEBUG: "" |
| steps: |
| - name: Check out code |
| uses: actions/checkout@v4 |
| with: |
| ref: release-${{ github.event.inputs.RELEASE }} |
| - name: Set git config |
| run: | |
| git config user.name $GITHUB_ACTOR |
| git config user.email actions@"$RUNNER_NAME".local |
| - name: Enable debugging |
| if: ${{github.event.inputs.DEBUG == 'yes'}} |
| run: | |
| echo "DEBUG=--debug" >> $GITHUB_ENV |
| - name: Set version and commit |
| run: | |
| bash "${SCRIPT_DIR}/set_version.sh" "${{ github.event.inputs.RELEASE }}" --release \ |
| --git-add $DEBUG |
| # suppress warning about detached HEAD: we want it detached so we do not edit the branch |
| git checkout --quiet ${{ github.event.inputs.COMMIT }} |
| git commit -m "Set version for ${{ github.event.inputs.RELEASE }} RC${{ github.event.inputs.RC }}" |
| - name: Overwrite tag |
| run: | |
| if git rev-parse "$RC_TAG" >/dev/null 2>&1; then |
| if [[ "${{ github.event.inputs.OVERWRITE }}" == yes ]]; then |
| git push origin ":refs/tags/$RC_TAG" |
| else |
| echo "Tag $RC_TAG already exists. Either delete it manually or run with --overwrite. Do not overwrite if an RC has been built and shared!" |
| exit 1 |
| fi |
| fi |
| - name: Tag for Go SDK |
| # Go Modules defined in sub directories need to have a prefixed tag |
| # in order to get the matching version. |
| # See BEAM-13119 for context. |
| run: git tag -a "sdks/$RC_TAG" -m "Go SDK $RC_TAG" HEAD |
| - name: Primary tag for the repo |
| run: git tag -a -m "$RC_TAG" "$RC_TAG" HEAD |
| - name: Push tag |
| if: ${{github.event.inputs.PUSH_TAG == 'yes'}} |
| run: | |
| git push --follow-tags origin "sdks/$RC_TAG" |
| git push --follow-tags origin "$RC_TAG" |
| |