Skip to content

Commit 2c2211e

Browse files
authored
Add Action to generate ManagedIO doc PR (#35828)
* Add workflow action for generating managed-io doc PR * add flag control * Fix no doc change case * Allow empty commit * Checkout from master * update text
1 parent ad2371e commit 2c2211e

File tree

1 file changed

+70
-1
lines changed

1 file changed

+70
-1
lines changed

.github/workflows/build_release_candidate.yml

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,17 @@ on:
4040
beam_site_pr: create the documentation update PR against apache/beam-site.
4141
--
4242
prism: build and upload the artifacts to the release for this tag
43+
--
44+
managed_io_docs_pr: create the managed-io.md update PR against apache/beam.
4345
required: true
4446
default: |
4547
{java_artifacts: "no",
4648
java_source: "no",
4749
docker_artifacts: "no",
4850
python_artifacts: "no",
4951
beam_site_pr: "no",
50-
prism: "no"}
52+
prism: "no",
53+
managed_io_docs_pr: "no"}
5154
5255
env:
5356
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
@@ -545,3 +548,69 @@ jobs:
545548
svn add --force --parents prism
546549
svn status
547550
svn commit -m "Staging Prism artifacts for Apache Beam ${RELEASE} RC${RC_NUM}" --non-interactive --username "${{ github.event.inputs.APACHE_ID }}" --password "${{ github.event.inputs.APACHE_PASSWORD }}"
551+
552+
managed_io_docs_pr:
553+
if: ${{ fromJson(github.event.inputs.STAGE).managed_io_docs_pr == 'yes'}}
554+
runs-on: ubuntu-22.04
555+
env:
556+
BRANCH_NAME: updates_managed_io_docs_${{ github.event.inputs.RELEASE }}_rc${{ github.event.inputs.RC }}
557+
BEAM_ROOT_DIR: ${{ github.workspace }}/beam
558+
MANAGED_IO_DOCS_PATH: website/www/site/content/en/documentation/io/managed-io.md
559+
steps:
560+
- name: Checkout Beam Repo
561+
uses: actions/checkout@v4
562+
with:
563+
ref: "v${{ github.event.inputs.RELEASE }}-RC${{ github.event.inputs.RC }}"
564+
repository: apache/beam
565+
path: beam
566+
token: ${{ github.event.inputs.REPO_TOKEN }}
567+
persist-credentials: false
568+
- name: Install Python 3.9
569+
uses: actions/setup-python@v5
570+
with:
571+
python-version: '3.9'
572+
- name: Install Java 11
573+
uses: actions/setup-java@v4
574+
with:
575+
distribution: 'temurin'
576+
java-version: '11'
577+
- name: Remove default github maven configuration
578+
# This step is a workaround to avoid a decryption issue of Beam's
579+
# net.linguica.gradle.maven.settings plugin and github's provided maven
580+
# settings.xml file
581+
run: rm ~/.m2/settings.xml || true
582+
- name: Install SDK
583+
working-directory: beam/sdks/python
584+
run: |
585+
pip install -e.
586+
- name: Build Expansion Service Jar
587+
working-directory: beam
588+
run: |
589+
./gradlew sdks:java:io:expansion-service:shadowJar
590+
- name: Build GCP Expansion Service Jar
591+
working-directory: beam
592+
run: |
593+
./gradlew sdks:java:io:google-cloud-platform:expansion-service:shadowJar
594+
- name: Generate Managed IO Docs
595+
working-directory: beam/sdks/python
596+
run: |
597+
python gen_managed_doc.py --output_location ${{ runner.temp }}/managed-io.md
598+
- name: Create commit on beam branch
599+
working-directory: beam
600+
run: |
601+
git fetch origin master
602+
git checkout -b $BRANCH_NAME origin/master
603+
mv ${{ runner.temp }}/managed-io.md ${{ env.MANAGED_IO_DOCS_PATH }}
604+
git config user.name $GITHUB_ACTOR
605+
git config user.email actions@"$RUNNER_NAME".local
606+
git add ${{ env.MANAGED_IO_DOCS_PATH }}
607+
git commit --allow-empty -m "Update managed-io.md for release ${{ github.event.inputs.RELEASE }}-RC${{ github.event.inputs.RC }}."
608+
git push -f --set-upstream origin $BRANCH_NAME
609+
- name: Create beam PR
610+
working-directory: beam
611+
env:
612+
GH_TOKEN: ${{ github.event.inputs.REPO_TOKEN }}
613+
PR_TITLE: "Update managed-io.md for release ${{ github.event.inputs.RELEASE }}-RC${{ github.event.inputs.RC }}"
614+
PR_BODY: "Content generated from release ${{ github.event.inputs.RELEASE }}-RC${{ github.event.inputs.RC }}."
615+
run: |
616+
gh pr create -t "$PR_TITLE" -b "$PR_BODY" --base master --repo apache/beam

0 commit comments

Comments
 (0)