-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Experimental minor_release workflow (#204)
* experimental minor_release workflow * Update minor_release.yml * Update RELEASE.md * Update minor_release.yml * Update minor_release.yml * Create update_main.py * update release.md * add more details to release.md
- Loading branch information
Showing
4 changed files
with
160 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: Create Minor Release | ||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
createrelease: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
- name: Set minor version | ||
id: set-version | ||
run: | | ||
echo "::set-output name=version::$(python ./.github/workflows/prepare_minor_release.py)" | ||
- name: Create release branch | ||
run: git checkout -b r${{ steps.set-version.outputs.version }} | ||
- name: Initialize mandatory git config | ||
run: | | ||
git config user.name "GitHub Actions" | ||
git config user.email [email protected] | ||
- name: Commit changelog and manifest files | ||
id: make-commit | ||
run: | | ||
git add tfx_addons/version.py | ||
git commit --message "Prepare release ${{ steps.set-version.outputs.version }}" | ||
echo "::set-output name=commit::$(git rev-parse HEAD)" | ||
- name: Push new branch | ||
run: git push origin r${{ steps.set-version.outputs.version }} | ||
- uses: ncipollo/release-action@v1 | ||
with: | ||
name: v${{ steps.set-version.outputs.version }}.0rc0 | ||
commit: ${{ steps.make-commit.outputs.commit }} | ||
prerelease: true | ||
draft: true | ||
generateReleaseNotes: true | ||
skipIfReleaseExists: true | ||
tag: v${{ steps.set-version.outputs.version }}.0rc0 | ||
- name: Update main | ||
id: update-main | ||
run: | | ||
git checkout main | ||
echo "::set-output name=new_version::$(python ./.github/workflows/update_main.py)" | ||
- name: Commit main change | ||
run: | | ||
git checkout -b ${{ github.triggering_actor }}/update-${{ steps.update-main.outputs.new_version }} | ||
git add tfx_addons/version.py | ||
git commit --message "Update main to ${{ steps.update-main.outputs.new_version }}" | ||
git push origin ${{ github.triggering_actor }}/update-${{ steps.update-main.outputs.new_version }} | ||
- name: Create pull request into main | ||
uses: thomaseizinger/[email protected] | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
head: ${{ github.triggering_actor }}/update-${{ steps.update-main.outputs.new_version }} | ||
base: main | ||
title: Update minor version to ${{ steps.update-main.outputs.new_version }} | ||
reviewers: ${{ github.triggering_actor }} | ||
body: | | ||
This is an automatic PR triggered by ${{ github.triggering_actor }} to prepare for ${{ steps.set-version.outputs.version }} release. | ||
Approve and merge in order to update main branch to ${{ steps.update-main.outputs.new_version }}. | ||
Check out [RELEASE.md](https://github.com/tensorflow/tfx-addons/blob/main/RELEASE.md) for more details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Copyright 2022 The TensorFlow Authors. All Rights Reserved. | ||
# | ||
# Licensed 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. | ||
# ============================================================================== | ||
"""Internal script to perform a minor release""" | ||
import logging | ||
import os | ||
import sys | ||
|
||
logging.getLogger().setLevel(logging.INFO) | ||
# Dynamically load root as module so that we can import version | ||
BASE_DIR = os.path.dirname( | ||
os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | ||
sys.path.append(BASE_DIR) | ||
|
||
import tfx_addons as tfxa # pylint: disable=wrong-import-position | ||
|
||
current_version = tfxa.__version__ | ||
major, minor, patch = current_version.split(".") | ||
|
||
with open(os.path.join(BASE_DIR, "tfx_addons", "version.py")) as f: | ||
lines = f.readlines() | ||
|
||
with open(os.path.join(BASE_DIR, "tfx_addons", "version.py"), "w") as f: | ||
for l in lines: | ||
if l.startswith("_VERSION_SUFFIX"): | ||
f.write('_VERSION_SUFFIX = "rc0"\n') | ||
else: | ||
f.write(l) | ||
|
||
print(".".join([major, minor])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Copyright 2022 The TensorFlow Authors. All Rights Reserved. | ||
# | ||
# Licensed 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. | ||
# ============================================================================== | ||
"""Internal script to perform a minor release""" | ||
import logging | ||
import os | ||
import sys | ||
|
||
logging.getLogger().setLevel(logging.INFO) | ||
# Dynamically load root as module so that we can import version | ||
BASE_DIR = os.path.dirname( | ||
os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | ||
sys.path.append(BASE_DIR) | ||
|
||
import tfx_addons as tfxa # pylint: disable=wrong-import-position | ||
|
||
current_version = tfxa.__version__ | ||
major, minor, patch = current_version.split(".") | ||
|
||
with open(os.path.join(BASE_DIR, "tfx_addons", "version.py")) as f: | ||
lines = f.readlines() | ||
|
||
with open(os.path.join(BASE_DIR, "tfx_addons", "version.py"), "w") as f: | ||
for l in lines: | ||
if l.startswith("_MINOR_VERSION"): | ||
next_minor = int(minor) + 1 | ||
f.write(f'_MINOR_VERSION = "{next_minor}"\n') | ||
else: | ||
f.write(l) | ||
|
||
print(".".join([major, str(next_minor)])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters