|
| 1 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +# or more contributor license agreements. See the NOTICE file |
| 3 | +# distributed with this work for additional information |
| 4 | +# regarding copyright ownership. The ASF licenses this file |
| 5 | +# to you under the Apache License, Version 2.0 (the |
| 6 | +# "License"); you may not use this file except in compliance |
| 7 | +# with the License. You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, |
| 12 | +# software distributed under the License is distributed on an |
| 13 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +# KIND, either express or implied. See the License for the |
| 15 | +# specific language governing permissions and limitations |
| 16 | +# under the License. |
| 17 | + |
| 18 | +# This workflow will update apache beam master branch with next release version |
| 19 | +# and cut release branch for current development version. |
| 20 | + |
| 21 | +# To learn more about GitHub Actions in Apache Beam check the CI.md |
| 22 | + |
| 23 | +name: Cut Release Branch |
| 24 | +on: |
| 25 | + workflow_dispatch: |
| 26 | + inputs: |
| 27 | + RELEASE_VERSION: |
| 28 | + description: Beam version of current release |
| 29 | + required: true |
| 30 | + NEXT_VERSION: |
| 31 | + description: Next release version |
| 32 | + required: true |
| 33 | + |
| 34 | +jobs: |
| 35 | + update_master: |
| 36 | + runs-on: [self-hosted, ubuntu-20.04] |
| 37 | + env: |
| 38 | + MASTER_BRANCH: master |
| 39 | + NEXT_RELEASE: ${{ github.event.inputs.NEXT_VERSION }} |
| 40 | + SCRIPT_DIR: ./release/src/main/scripts |
| 41 | + steps: |
| 42 | + - name: Validate Next Version |
| 43 | + run: | |
| 44 | + if [[ $NEXT_RELEASE =~ ([0-9]+\.[0-9]+\.[0-9]+) ]]; then |
| 45 | + echo "NEXT_VERSION_IN_BASE_BRANCH=${BASH_REMATCH[1]}" >> $GITHUB_ENV |
| 46 | + else |
| 47 | + echo "The input for NEXT_RELEASE does not match a valid format [0-9]+\.[0-9]+\.[0-9]+" |
| 48 | + exit 1 |
| 49 | + fi |
| 50 | + - name: Check out code |
| 51 | + uses: actions/checkout@v3 |
| 52 | + - name: Set git config |
| 53 | + run: | |
| 54 | + git config user.name $GITHUB_ACTOR |
| 55 | + git config user.email actions@"$RUNNER_NAME".local |
| 56 | + - name: Update master branch |
| 57 | + run: | |
| 58 | + bash "${SCRIPT_DIR}/set_version.sh" "${NEXT_VERSION_IN_BASE_BRANCH}" |
| 59 | + echo "==============Update master branch as following================" |
| 60 | + git diff |
| 61 | + echo "===============================================================" |
| 62 | + - name: Commit and Push to master branch files with Next Version |
| 63 | + run: | |
| 64 | + git add * |
| 65 | + git commit -m "Moving to ${NEXT_VERSION_IN_BASE_BRANCH}-SNAPSHOT on master branch." |
| 66 | + git push origin ${MASTER_BRANCH} |
| 67 | +
|
| 68 | + update_release_branch: |
| 69 | + needs: update_master |
| 70 | + runs-on: [self-hosted, ubuntu-20.04] |
| 71 | + env: |
| 72 | + RELEASE: ${{ github.event.inputs.RELEASE_VERSION }} |
| 73 | + steps: |
| 74 | + - name: Validate Release Version |
| 75 | + run: | |
| 76 | + if [[ ${RELEASE} =~ ([0-9]+\.[0-9]+\.[0-9]+) ]]; then |
| 77 | + echo "RELEASE_VERSION=${BASH_REMATCH[1]}" >> $GITHUB_ENV |
| 78 | + echo "RELEASE_BRANCH=release-${RELEASE}" >> $GITHUB_ENV |
| 79 | + else |
| 80 | + echo "The input for RELEASE does not match a valid format [0-9]+\.[0-9]+\.[0-9]+" |
| 81 | + exit 1 |
| 82 | + fi |
| 83 | + - name: Check out code |
| 84 | + uses: actions/checkout@v3 |
| 85 | + - name: Set git config |
| 86 | + run: | |
| 87 | + git config user.name $GITHUB_ACTOR |
| 88 | + git config user.email actions@"$RUNNER_NAME".local |
| 89 | + - name: Checkout to release branch |
| 90 | + run: | |
| 91 | + git checkout -b ${RELEASE_BRANCH} |
| 92 | + echo "==================Current working branch=======================" |
| 93 | + echo ${RELEASE_BRANCH} |
| 94 | + echo "===============================================================" |
| 95 | + - name: Update release version for dataflow runner |
| 96 | + run: | |
| 97 | + sed -i -e "s/'beam-master-.*'/'${RELEASE}'/g" \ |
| 98 | + runners/google-cloud-dataflow-java/build.gradle |
| 99 | + echo "===============Update release branch as following==============" |
| 100 | + git diff |
| 101 | + echo "===============================================================" |
| 102 | + - name: Commit and Push to release branch |
| 103 | + run: | |
| 104 | + git add runners/google-cloud-dataflow-java/build.gradle |
| 105 | + git commit -m "Set Dataflow container to release version." |
| 106 | + git push --set-upstream origin ${RELEASE_BRANCH} |
| 107 | +
|
| 108 | +
|
| 109 | +
|
| 110 | +
|
| 111 | +
|
0 commit comments