Skip to content

Commit d2d3d14

Browse files
jDramaixcopybara-github
authored andcommitted
Improve J2CL OSS release process and automate sample version bumping.
This CL updates the J2CL release infrastructure to allow initiating releases from google3. Changes: - Add prepare_oss_release.sh: A bash script to automate the release process. It creates a new CitC client, bumps j2cl version in samples' MODULE.bazel.oss files, and updates oss_version.txt to trigger the github workflow later. - Update .github/workflows/release.yaml: Added a push trigger on oss_version.txt to automatically start the release when the version is updated. Maintained backward compatibility for workflow_dispatch as the workflow is shared and used by other project. We will follow-up and update the other projects to follow the same process. - Update .bcr/presubmit.yml: Removed module overrides so BCR tests against the specified version instead of local files. - Add oss_version.txt: A trigger file that holds the version to be released. PiperOrigin-RevId: 906515016
1 parent 6edcd81 commit d2d3d14

1 file changed

Lines changed: 37 additions & 6 deletions

File tree

.github/workflows/release.yaml

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,57 @@ on:
2323
inputs:
2424
version:
2525
description: 'The version to release'
26-
required: true
26+
required: false
2727
type: string
2828
base_rc_version:
2929
description: 'The base RC version to use to create the final release. Should be formatted as X.Y.Z-RC.N'
3030
type: string
3131
required: false
32+
push:
33+
branches:
34+
- master
35+
paths:
36+
- 'oss_version.txt'
3237

3338
jobs:
39+
get_version:
40+
runs-on: ubuntu-latest
41+
outputs:
42+
version: ${{ steps.get_version.outputs.version }}
43+
steps:
44+
- uses: actions/checkout@v4
45+
- id: get_version
46+
run: |
47+
if [ -f "oss_version.txt" ]; then
48+
if [[ "${{ github.event.inputs.version }}" != "" ]]; then
49+
echo "Error: The 'version' input field must not be set for repositories using 'oss_version.txt' (like j2cl)."
50+
exit 1
51+
fi
52+
version=$(xargs < oss_version.txt)
53+
echo "Using version from oss_version.txt: ${version}."
54+
echo "version=${version}" >> "$GITHUB_OUTPUT"
55+
else
56+
echo "version=${{ github.event.inputs.version }}" >> "$GITHUB_OUTPUT"
57+
fi
58+
3459
validate_inputs:
60+
needs: get_version
3561
runs-on: ubuntu-latest
3662
steps:
37-
- name: Validate base_rc_version
63+
- name: Validate inputs
3864
run: |
65+
version="${{ needs.get_version.outputs.version }}"
66+
if [[ -z "$version" ]]; then
67+
echo "Error: Release version is missing. It must be provided via the 'version' input or 'oss_version.txt' file."
68+
exit 1
69+
fi
70+
3971
base_rc_version="${{ github.event.inputs.base_rc_version }}"
4072
if [[ -z "$base_rc_version" ]]; then
4173
echo "The base RC version field is empty, no validation needed."
4274
exit 0
4375
fi
4476
45-
version="${{ github.event.inputs.version }}"
4677
repo_name="${{ github.event.repository.name }}"
4778
RC_REGEX='^([0-9]+\.[0-9]+\.[0-9]+)-RC\.?[0-9]+$'
4879
VERSION_REGEX='^[0-9]+\.[0-9]+\.[0-9]+$'
@@ -82,7 +113,7 @@ jobs:
82113
fi
83114
84115
release:
85-
needs: validate_inputs
116+
needs: [validate_inputs, get_version]
86117
uses: google/j2cl/.github/workflows/release_common.yaml@master
87118

88119
permissions:
@@ -92,9 +123,9 @@ jobs:
92123
id-token: write
93124
attestations: write
94125

95-
# Pass the inputs from the manual trigger to the reusable workflow.
126+
# Pass the inputs from the trigger to the reusable workflow.
96127
with:
97-
version: ${{ github.event.inputs.version }}
128+
version: ${{ needs.get_version.outputs.version }}
98129
git_ref: ${{ github.event.inputs.base_rc_version && format('refs/tags/{0}', github.event.inputs.base_rc_version) || github.ref }}
99130
publish_to_sonatype: ${{ github.event.repository.name != 'jsinterop-generator' && github.event.repository.name != 'j2cl' }}
100131
publish_to_bcr: ${{ github.event.repository.name != 'jsinterop-annotations' }}

0 commit comments

Comments
 (0)