Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/publish-wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Publish Wheels

on:
push:
tags:
- "v[0-9]*"
- "test*"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
ref: ${{ github.ref }}
fetch-depth: 0

- uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Build wheel and sdist
run: |
python -m pip install --upgrade pip build
python -m build

- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/*

publish:
name: Publish to PyPI
needs: [build]
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist

- name: Publish to TestPyPI (test tags)
if: startsWith(github.ref, 'refs/tags/test')
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
packages-dir: dist
skip-existing: true
verbose: true

- name: Publish to PyPI (real releases)
if: startsWith(github.ref, 'refs/tags/v')
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist
10 changes: 10 additions & 0 deletions .github/workflows/pull_request_closed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,21 @@ jobs:
ref: develop
fetch-depth: 0
token: ${{ secrets.BOT_ACCESS_TOKEN }}

- name: Bump version
run: ./.github/workflows/version_bumper.sh ./pyproject.toml
id: bump

- name: Commit and push
run: |
git config user.name "AVSlabBot"
git config user.email "cuavslab@gmail.com"
git commit -a -m "[AUTO] Bump minor version number"
git push
- name: Create tag
if: ${{ steps.bump.outputs.updated_version != '' }}
run: |
git tag -a "v${{ steps.bump.outputs.updated_version }}" \
-m "Release v${{ steps.bump.outputs.updated_version }}"
git push --tags
14 changes: 11 additions & 3 deletions .github/workflows/version_bumper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,20 @@ if [[ $version_line =~ $regex ]]; then
last_number=${BASH_REMATCH[2]}
incremented_number=$((last_number + 1))
updated_version=${BASH_REMATCH[1]}$incremented_number

# Update the version in the pyproject.toml file
sed -i "s/version = \"${BASH_REMATCH[1]}${last_number}\"/version = \"$updated_version\"/" "$file"

echo "Version updated to $updated_version in $file"
else
echo "Error: Version not found in $file or not in X.Y.Z format"
exit 1
fi
fi


# Expose the update versions to GitHub Actions
if [[ -n "${GITHUB_OUTPUT:-}" ]]; then
{
echo "updated_version=$updated_version"
} >> "$GITHUB_OUTPUT"
fi
Loading