-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: release automations #33
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# This workflow will generate a distribution and upload it to PyPI | ||
name: Publish Alpha Build ...aX | ||
on: | ||
push: | ||
|
@@ -14,15 +15,59 @@ on: | |
- "MANIFEST.in" | ||
- "README.md" | ||
- "scripts/**" | ||
- "translations/**" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build_and_publish: | ||
uses: openvoiceos/.github/.github/workflows/publish_alpha_release.yml@feat/shared_actions1 | ||
secrets: inherit | ||
with: | ||
version_file: version.py # File location of the version file, default: version.py | ||
python_version: "3.10" | ||
locale_folder: locale | ||
update_intentfile: test/test_intents.yaml | ||
changelog_file: CHANGELOG.md | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: dev | ||
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. | ||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.8 | ||
- name: Install Build Tools | ||
run: | | ||
python -m pip install build wheel | ||
- name: Increment Version | ||
run: | | ||
VER=$(python setup.py --version) | ||
python scripts/bump_alpha.py | ||
- name: "Generate release changelog" | ||
uses: heinrichreimer/github-changelog-generator-action@v2.3 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
maxIssues: 50 | ||
id: changelog | ||
- name: Commit to dev | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: Increment Version | ||
branch: dev | ||
- name: version | ||
run: echo "::set-output name=version::$(python setup.py --version)" | ||
id: version | ||
Comment on lines
+35
to
+52
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Update deprecated syntax for setting output The Update the "version" step as follows: - name: Set version output
run: echo "version=$(python setup.py --version)" >> $GITHUB_OUTPUT
id: version Add error handling to version increment step The version increment step doesn't include any error handling. Consider adding checks to ensure the script executes successfully and the version is incremented as expected. Example: - name: Increment Version
run: |
python scripts/bump_alpha.py
if [ $? -ne 0 ]; then
echo "Failed to increment version"
exit 1
fi
NEW_VER=$(python setup.py --version)
if [ "$NEW_VER" == "$VER" ]; then
echo "Version was not incremented"
exit 1
fi 🧰 Tools🪛 actionlint
|
||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | ||
with: | ||
tag_name: V${{ steps.version.outputs.version }} | ||
release_name: Release ${{ steps.version.outputs.version }} | ||
body: | | ||
Changes in this Release | ||
${{ steps.changelog.outputs.changelog }} | ||
draft: false | ||
prerelease: true | ||
commitish: dev | ||
- name: Build Distribution Packages | ||
run: | | ||
python setup.py bdist_wheel | ||
- name: Publish to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{secrets.PYPI_TOKEN}} | ||
Comment on lines
+67
to
+73
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Consider using modern build tools While Replace the "Build Distribution Packages" step with: - name: Build Distribution Packages
run: |
pip install build
python -m build This change uses the |
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,84 @@ | ||||||||||||||
# This workflow will generate a distribution and upload it to PyPI | ||||||||||||||
name: Publish Build Release ..X | ||||||||||||||
on: | ||||||||||||||
workflow_dispatch: | ||||||||||||||
jobs: | ||||||||||||||
build_and_publish: | ||||||||||||||
runs-on: ubuntu-latest | ||||||||||||||
steps: | ||||||||||||||
- uses: actions/checkout@v4 | ||||||||||||||
with: | ||||||||||||||
ref: dev | ||||||||||||||
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. | ||||||||||||||
- name: Setup Python | ||||||||||||||
uses: actions/setup-python@v5 | ||||||||||||||
with: | ||||||||||||||
python-version: 3.10 | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Consider using the latest Python version While Python 3.10 is stable, consider using the latest version (3.11 or 3.12 as of October 2024) to take advantage of performance improvements and new features, unless there's a specific reason to use 3.10. You can update the Python version like this: - python-version: 3.10
+ python-version: 3.12 📝 Committable suggestion
Suggested change
|
||||||||||||||
- name: Install Build Tools | ||||||||||||||
run: | | ||||||||||||||
python -m pip install build wheel | ||||||||||||||
- name: Remove alpha (declare stable) | ||||||||||||||
run: | | ||||||||||||||
VER=$(python setup.py --version) | ||||||||||||||
python scripts/remove_alpha.py | ||||||||||||||
Comment on lines
+20
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove unused variable 'VER' The 'VER' variable is assigned but never used, which can lead to confusion. Consider removing it if it's not needed for the Apply this change: - run: |
- VER=$(python setup.py --version)
- python scripts/remove_alpha.py
+ run: python scripts/remove_alpha.py If the version is needed in the script, consider passing it as an argument: - run: |
- VER=$(python setup.py --version)
- python scripts/remove_alpha.py
+ run: |
+ VER=$(python setup.py --version)
+ python scripts/remove_alpha.py "$VER" 📝 Committable suggestion
Suggested change
🧰 Tools🪛 actionlint
|
||||||||||||||
- name: "Generate release changelog" | ||||||||||||||
uses: heinrichreimer/github-changelog-generator-action@v2.3 | ||||||||||||||
with: | ||||||||||||||
token: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||||
id: changelog | ||||||||||||||
- name: Commit to dev | ||||||||||||||
uses: stefanzweifel/git-auto-commit-action@v4 | ||||||||||||||
with: | ||||||||||||||
commit_message: Declare alpha stable | ||||||||||||||
branch: dev | ||||||||||||||
- name: Push dev -> master | ||||||||||||||
uses: ad-m/github-push-action@master | ||||||||||||||
with: | ||||||||||||||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||||
branch: master | ||||||||||||||
force: true | ||||||||||||||
- name: version | ||||||||||||||
run: echo "::set-output name=version::$(python setup.py --version)" | ||||||||||||||
id: version | ||||||||||||||
Comment on lines
+40
to
+42
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update deprecated 'set-output' command The Replace the current step with: - name: Get version
id: version
run: echo "version=$(python setup.py --version)" >> $GITHUB_OUTPUT 🧰 Tools🪛 actionlint
|
||||||||||||||
- name: Create Release | ||||||||||||||
id: create_release | ||||||||||||||
uses: actions/create-release@v1 | ||||||||||||||
env: | ||||||||||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | ||||||||||||||
with: | ||||||||||||||
tag_name: V${{ steps.version.outputs.version }} | ||||||||||||||
release_name: Release ${{ steps.version.outputs.version }} | ||||||||||||||
body: | | ||||||||||||||
Changes in this Release | ||||||||||||||
${{ steps.changelog.outputs.changelog }} | ||||||||||||||
draft: false | ||||||||||||||
prerelease: false | ||||||||||||||
commitish: dev | ||||||||||||||
- name: Build Distribution Packages | ||||||||||||||
run: | | ||||||||||||||
python setup.py bdist_wheel | ||||||||||||||
Comment on lines
+57
to
+59
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Consider adding a source distribution build While building a wheel distribution is good, it's also recommended to build a source distribution for maximum compatibility. Update the build step to include both wheel and sdist: - - name: Build Distribution Packages
+ - name: Build Distribution Packages
run: |
- python setup.py bdist_wheel
+ python -m build Note: This requires the 📝 Committable suggestion
Suggested change
|
||||||||||||||
- name: Prepare next Build version | ||||||||||||||
run: echo "::set-output name=version::$(python setup.py --version)" | ||||||||||||||
id: alpha | ||||||||||||||
Comment on lines
+60
to
+62
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update deprecated 'set-output' command Similar to the previous instance, update this step to use the Replace the current step with: - name: Prepare next Build version
id: alpha
run: echo "version=$(python setup.py --version)" >> $GITHUB_OUTPUT 🧰 Tools🪛 actionlint
|
||||||||||||||
- name: Increment Version ${{ steps.alpha.outputs.version }}Alpha0 | ||||||||||||||
run: | | ||||||||||||||
VER=$(python setup.py --version) | ||||||||||||||
python scripts/bump_build.py | ||||||||||||||
mikejgray marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
- name: Commit to dev | ||||||||||||||
uses: stefanzweifel/git-auto-commit-action@v4 | ||||||||||||||
with: | ||||||||||||||
commit_message: Prepare Next Version | ||||||||||||||
branch: dev | ||||||||||||||
- name: Publish to PyPI | ||||||||||||||
uses: pypa/gh-action-pypi-publish@release/v1 | ||||||||||||||
with: | ||||||||||||||
password: ${{secrets.PYPI_TOKEN}} | ||||||||||||||
- name: Send message to Matrix bots channel | ||||||||||||||
id: matrix-chat-message | ||||||||||||||
uses: fadenb/matrix-chat-message@v0.0.6 | ||||||||||||||
with: | ||||||||||||||
homeserver: "matrix.org" | ||||||||||||||
token: ${{ secrets.MATRIX_TOKEN }} | ||||||||||||||
channel: "!WjxEKjjINpyBRPFgxl:krbel.duckdns.org" | ||||||||||||||
message: | | ||||||||||||||
New skill-ovos-fallback-unknown release! ${{ steps.version.outputs.version }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# This workflow will generate a distribution and upload it to PyPI | ||
name: Publish Major Release X.0.0 | ||
on: | ||
workflow_dispatch: | ||
jobs: | ||
build_and_publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: dev | ||
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. | ||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.10 | ||
- name: Install Build Tools | ||
run: | | ||
python -m pip install build wheel | ||
- name: Remove alpha (declare stable) | ||
run: | | ||
VER=$(python setup.py --version) | ||
python scripts/remove_alpha.py | ||
- name: "Generate release changelog" | ||
uses: heinrichreimer/github-changelog-generator-action@v2.3 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
id: changelog | ||
- name: Commit to dev | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: Declare alpha stable | ||
branch: dev | ||
- name: Push dev -> master | ||
uses: ad-m/github-push-action@master | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
branch: master | ||
force: true | ||
mikejgray marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- name: version | ||
run: echo "::set-output name=version::$(python setup.py --version)" | ||
id: version | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | ||
with: | ||
tag_name: V${{ steps.version.outputs.version }} | ||
release_name: Release ${{ steps.version.outputs.version }} | ||
body: | | ||
Changes in this Release | ||
${{ steps.changelog.outputs.changelog }} | ||
draft: false | ||
prerelease: false | ||
commitish: master | ||
- name: Build Distribution Packages | ||
run: | | ||
python setup.py bdist_wheel | ||
mikejgray marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- name: Prepare next Major version | ||
run: echo "::set-output name=version::$(python setup.py --version)" | ||
id: alpha | ||
- name: Increment Version ${{ steps.alpha.outputs.version }}Alpha0 | ||
run: | | ||
VER=$(python setup.py --version) | ||
python scripts/bump_major.py | ||
- name: Commit to dev | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: Prepare Next Version | ||
branch: dev | ||
mikejgray marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- name: Publish to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{secrets.PYPI_TOKEN}} | ||
- name: Send message to Matrix bots channel | ||
id: matrix-chat-message | ||
uses: fadenb/matrix-chat-message@v0.0.6 | ||
with: | ||
homeserver: "matrix.org" | ||
token: ${{ secrets.MATRIX_TOKEN }} | ||
channel: "!WjxEKjjINpyBRPFgxl:krbel.duckdns.org" | ||
message: | | ||
New skill-ovos-fallback-unknown release! ${{ steps.version.outputs.version }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# This workflow will generate a distribution and upload it to PyPI | ||
name: Publish Minor Release .X.0 | ||
on: | ||
workflow_dispatch: | ||
jobs: | ||
build_and_publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: dev | ||
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. | ||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.10 | ||
- name: Install Build Tools | ||
run: | | ||
python -m pip install build wheel | ||
- name: Remove alpha (declare stable) | ||
run: | | ||
VER=$(python setup.py --version) | ||
python scripts/remove_alpha.py | ||
- name: "Generate release changelog" | ||
uses: heinrichreimer/github-changelog-generator-action@v2.3 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
id: changelog | ||
- name: Commit to dev | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: Declare alpha stable | ||
branch: dev | ||
- name: Push dev -> master | ||
uses: ad-m/github-push-action@master | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
branch: master | ||
force: true | ||
- name: version | ||
run: echo "::set-output name=version::$(python setup.py --version)" | ||
id: version | ||
mikejgray marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | ||
with: | ||
tag_name: V${{ steps.version.outputs.version }} | ||
release_name: Release ${{ steps.version.outputs.version }} | ||
body: | | ||
Changes in this Release | ||
${{ steps.changelog.outputs.changelog }} | ||
draft: false | ||
prerelease: false | ||
commitish: master | ||
- name: Build Distribution Packages | ||
run: | | ||
python setup.py bdist_wheel | ||
- name: Prepare next Minor version | ||
run: echo "::set-output name=version::$(python setup.py --version)" | ||
id: alpha | ||
- name: Increment Version ${{ steps.alpha.outputs.version }}Alpha0 | ||
run: | | ||
VER=$(python setup.py --version) | ||
python scripts/bump_minor.py | ||
- name: Commit to dev | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: Prepare Next Version | ||
branch: dev | ||
- name: Publish to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{secrets.PYPI_TOKEN}} | ||
- name: Send message to Matrix bots channel | ||
id: matrix-chat-message | ||
uses: fadenb/matrix-chat-message@v0.0.6 | ||
with: | ||
homeserver: "matrix.org" | ||
token: ${{ secrets.MATRIX_TOKEN }} | ||
channel: "!WjxEKjjINpyBRPFgxl:krbel.duckdns.org" | ||
message: | | ||
New skill-ovos-fallback-unknown release! ${{ steps.version.outputs.version }} |
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Consider using a matrix strategy for multiple Python versions
Currently, the workflow is set up to use Python 3.8 specifically. To ensure compatibility with a wider range of Python versions, consider using a matrix strategy to test and build with multiple Python versions. This approach would help catch any version-specific issues early in the development process.
Example: