From 5cfe074dd060ecf7f09b30bc08de567b853393a8 Mon Sep 17 00:00:00 2001 From: Benjamin Gonzalez Date: Fri, 4 Nov 2022 17:23:33 -0600 Subject: [PATCH 1/3] Add workflow to run cut_release_branch --- .github/workflows/cut_release_branch.yml | 123 +++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 .github/workflows/cut_release_branch.yml diff --git a/.github/workflows/cut_release_branch.yml b/.github/workflows/cut_release_branch.yml new file mode 100644 index 000000000000..a59e307d049e --- /dev/null +++ b/.github/workflows/cut_release_branch.yml @@ -0,0 +1,123 @@ +# 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 update apache beam master branch with next release version +# and cut release branch for current development version. + +# To learn more about GitHub Actions in Apache Beam check the CI.md + +name: Cut Release Branch +on: + workflow_dispatch: + inputs: + RELEASE_VERSION: + description: Beam version of current release + required: true + NEXT_VERSION: + description: Next release version + required: true + +jobs: + update_master: +# TODO: Replace to use self-hosted runners + runs-on: ubuntu-latest + env: + MASTER_BRANCH: master + NEXT_RELEASE: ${{ github.event.inputs.NEXT_VERSION }} + steps: + - name: Validate Next Version + run: | + if [[ ${NEXT_RELEASE} =~ ([0-9]\.[0-9]*\.[0-9]) ]]; then + NEXT_VERSION_IN_BASE_BRANCH=${BASH_REMATCH[1]} + fi + if [[ -z "$NEXT_VERSION_IN_BASE_BRANCH" ]]; then + echo "The input for NEXT_RELEASE does not match a valid format [0-9].[0-9].[0-9]" + exit 1 + fi + - name: Echo value + run: | + echo "NEXT_VERSION_IN_BASE_BRANCH: ${NEXT_VERSION_IN_BASE_BRANCH}" + - name: Check out code + uses: actions/checkout@v3 + - name: Set git config + run: | + git config user.name $GITHUB_ACTOR + git config user.email actions@"$RUNNER_NAME".local + - name: Update master branch + run: | + sh ./set_version.sh "$NEXT_VERSION_IN_BASE_BRANCH" + echo "==============Update master branch as following================" + git diff + echo "===============================================================" + working-directory: 'release/src/main/scripts' + - name: Commit and Push to master branch files with Next Version + run: | + git add buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy + git add gradle.properties + git add sdks/python/apache_beam/version.py + git add sdks/go/pkg/beam/core/core.go + git commit -m "Moving to ${NEXT_VERSION_IN_BASE_BRANCH}-SNAPSHOT on master branch." + git push --dry-run origin ${MASTER_BRANCH} + + update_release_branch: +# TODO: Replace to use self-hosted runners + runs-on: ubuntu-latest + env: + RELEASE: ${{ github.event.inputs.RELEASE_VERSION }} + RELEASE_BRANCH: release-${RELEASE} + steps: + - name: Validate Release Version + run: | + if [[ ${RELEASE} =~ ([0-9]\.[0-9]*\.[0-9]) ]]; then + RELEASE_VERSION=${BASH_REMATCH[1]} + fi + if [[ -z "$RELEASE_VERSION" ]]; then + echo "The input for RELEASE does not match a valid format [0-9].[0-9].[0-9]" + exit 1 + fi + - name: Echo value + run: | + echo "RELEASE_VERSION: ${RELEASE_VERSION}" + - name: Check out code + uses: actions/checkout@v3 + - name: Set git config + run: | + git config user.name $GITHUB_ACTOR + git config user.email actions@"$RUNNER_NAME".local + - name: Checkout to release branch + run: | + git checkout -b ${RELEASE_BRANCH} + echo "==================Current working branch=======================" + echo ${RELEASE_BRANCH} + echo "===============================================================" + - name: Update release version for dataflow runner + run: | + sed -i -e "s/'beam-master-.*'/'${RELEASE}'/g" \ + runners/google-cloud-dataflow-java/build.gradle + echo "===============Update release branch as following==============" + git diff + echo "===============================================================" + - name: Commit and Push to release branch + run: | + git add runners/google-cloud-dataflow-java/build.gradle + git commit -m "Set Dataflow container to release version." + git push --dry-run --set-upstream origin ${RELEASE_BRANCH} + + + + + From 5fda65bcfe3171a048073ab83769672850a79ee8 Mon Sep 17 00:00:00 2001 From: Benjamin Gonzalez Date: Fri, 4 Nov 2022 17:43:05 -0600 Subject: [PATCH 2/3] Add pull_request for testing --- .github/workflows/cut_release_branch.yml | 37 +++++++++++++++++------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/.github/workflows/cut_release_branch.yml b/.github/workflows/cut_release_branch.yml index a59e307d049e..ced4d8af51a4 100644 --- a/.github/workflows/cut_release_branch.yml +++ b/.github/workflows/cut_release_branch.yml @@ -21,15 +21,28 @@ # To learn more about GitHub Actions in Apache Beam check the CI.md name: Cut Release Branch +# TODO: Remove, only for testing +inputs: + RELEASE_VERSION: + description: Beam version of current release + required: true + default: 2.44.0 + NEXT_VERSION: + description: Next release version + required: true + default: 2.45.0 on: - workflow_dispatch: - inputs: - RELEASE_VERSION: - description: Beam version of current release - required: true - NEXT_VERSION: - description: Next release version - required: true + # TODO: Remove, only for testing + pull_request: + # TODO: Uncomment, only for testing +# workflow_dispatch: +# inputs: +# RELEASE_VERSION: +# description: Beam version of current release +# required: true +# NEXT_VERSION: +# description: Next release version +# required: true jobs: update_master: @@ -41,16 +54,17 @@ jobs: steps: - name: Validate Next Version run: | - if [[ ${NEXT_RELEASE} =~ ([0-9]\.[0-9]*\.[0-9]) ]]; then + if [[ $NEXT_RELEASE =~ ([0-9]\.[0-9]*\.[0-9]) ]]; then NEXT_VERSION_IN_BASE_BRANCH=${BASH_REMATCH[1]} fi if [[ -z "$NEXT_VERSION_IN_BASE_BRANCH" ]]; then echo "The input for NEXT_RELEASE does not match a valid format [0-9].[0-9].[0-9]" exit 1 fi + echo "NEXT_VERSION_IN_BASE_BRANCH=${NEXT_VERSION_IN_BASE_BRANCH}" >> $GITHUB_ENV - name: Echo value run: | - echo "NEXT_VERSION_IN_BASE_BRANCH: ${NEXT_VERSION_IN_BASE_BRANCH}" + echo "NEXT_VERSION_IN_BASE_BRANCH: $NEXT_VERSION_IN_BASE_BRANCH" - name: Check out code uses: actions/checkout@v3 - name: Set git config @@ -78,7 +92,7 @@ jobs: runs-on: ubuntu-latest env: RELEASE: ${{ github.event.inputs.RELEASE_VERSION }} - RELEASE_BRANCH: release-${RELEASE} + RELEASE_BRANCH: release-${env.RELEASE} steps: - name: Validate Release Version run: | @@ -89,6 +103,7 @@ jobs: echo "The input for RELEASE does not match a valid format [0-9].[0-9].[0-9]" exit 1 fi + echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV - name: Echo value run: | echo "RELEASE_VERSION: ${RELEASE_VERSION}" From 6a715bd2b0ab8095a62fc06875d0af234713c353 Mon Sep 17 00:00:00 2001 From: Benjamin Gonzalez Date: Fri, 4 Nov 2022 18:49:13 -0600 Subject: [PATCH 3/3] Add pull_request for testing --- .github/workflows/cut_release_branch.yml | 29 +++++++----------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/.github/workflows/cut_release_branch.yml b/.github/workflows/cut_release_branch.yml index ced4d8af51a4..7315cfbf276b 100644 --- a/.github/workflows/cut_release_branch.yml +++ b/.github/workflows/cut_release_branch.yml @@ -21,28 +21,15 @@ # To learn more about GitHub Actions in Apache Beam check the CI.md name: Cut Release Branch -# TODO: Remove, only for testing -inputs: - RELEASE_VERSION: - description: Beam version of current release - required: true - default: 2.44.0 - NEXT_VERSION: - description: Next release version - required: true - default: 2.45.0 on: - # TODO: Remove, only for testing - pull_request: - # TODO: Uncomment, only for testing -# workflow_dispatch: -# inputs: -# RELEASE_VERSION: -# description: Beam version of current release -# required: true -# NEXT_VERSION: -# description: Next release version -# required: true + workflow_dispatch: + inputs: + RELEASE_VERSION: + description: Beam version of current release + required: true + NEXT_VERSION: + description: Next release version + required: true jobs: update_master: