Skip to content

Commit

Permalink
Experimental minor_release workflow (#204)
Browse files Browse the repository at this point in the history
* 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
casassg authored Feb 2, 2023
1 parent 79f1b19 commit 93ee7c9
Show file tree
Hide file tree
Showing 4 changed files with 160 additions and 1 deletion.
64 changes: 64 additions & 0 deletions .github/workflows/minor_release.yml
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.
41 changes: 41 additions & 0 deletions .github/workflows/prepare_minor_release.py
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]))
42 changes: 42 additions & 0 deletions .github/workflows/update_main.py
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)]))
14 changes: 13 additions & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,22 @@ TFX Addons follows [Semantic Versioning 2.0](https://semver.org/) strategy.

* See the [Release Notes](https://github.com/tensorflow/tfx-addons/releases) for current and past releases.

## Minor automatic release from main

1. Trigger [Create Minor Release](https://github.com/tensorflow/tfx-addons/actions/workflows/minor_release.yml] workflow and ensure it runs to completion.
2. Find created [draft release](https://github.com/tensorflow/tfx-addons/releases).
* Add updates for new features, enhancements, bug fixes
* Add contributors using `git shortlog <last-version>..HEAD -s`
3. Publish release.
* Check PyPI to ensure release candidate has been released.
* Send email to mailing list for vote.
4. Find the minor version PR created above and merge it.


## Major/Minor releases

1. Create new `rX.Y` branch on https://github.com/tensorflow/tfx-addons from `main`.
2. Create new PR with updates to `version.py` against `rX.Y` branch.
2. Update `version.py` in `rX.Y` branch.
* Set the correct version and suffix in [version.py](https://github.com/tensorflow/tfx-addons/blob/main/tfx_addons/version.py).
* Ensure the proper minimum and maximum tested versions of TFX are set in [version.py](https://github.com/tensorflow/tfx-addons/blob/main/tfx_addons/version.py).
* Ensure proper supported python libraries are set in [version.py](https://github.com/tensorflow/tfx-addons/blob/main/tfx_addons/version.py).
Expand Down

0 comments on commit 93ee7c9

Please sign in to comment.