Skip to content

Commit 7da091f

Browse files
[#310] Publish bsk_rl wheels to PyPi
1 parent 8d03f72 commit 7da091f

File tree

3 files changed

+79
-3
lines changed

3 files changed

+79
-3
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Publish Wheels
2+
3+
on:
4+
push:
5+
tags:
6+
- "v[0-9]*"
7+
- "test*"
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v5
14+
with:
15+
ref: ${{ github.ref }}
16+
fetch-depth: 0
17+
18+
- uses: actions/setup-python@v5
19+
with:
20+
python-version: "3.12"
21+
22+
- name: Build wheel and sdist
23+
run: |
24+
python -m pip install --upgrade pip build
25+
python -m build
26+
27+
- uses: actions/upload-artifact@v4
28+
with:
29+
name: dist
30+
path: dist/*
31+
32+
publish:
33+
name: Publish to PyPI
34+
needs: [build]
35+
runs-on: ubuntu-latest
36+
permissions:
37+
id-token: write
38+
contents: read
39+
steps:
40+
- uses: actions/download-artifact@v4
41+
with:
42+
name: dist
43+
path: dist
44+
45+
- name: Publish to TestPyPI (test tags)
46+
if: startsWith(github.ref, 'refs/tags/test')
47+
uses: pypa/gh-action-pypi-publish@release/v1
48+
with:
49+
repository-url: https://test.pypi.org/legacy/
50+
packages-dir: dist
51+
skip-existing: true
52+
verbose: true
53+
54+
- name: Publish to PyPI (real releases)
55+
if: startsWith(github.ref, 'refs/tags/v')
56+
uses: pypa/gh-action-pypi-publish@release/v1
57+
with:
58+
packages-dir: dist

.github/workflows/pull_request_closed.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,21 @@ jobs:
1919
ref: develop
2020
fetch-depth: 0
2121
token: ${{ secrets.BOT_ACCESS_TOKEN }}
22+
2223
- name: Bump version
2324
run: ./.github/workflows/version_bumper.sh ./pyproject.toml
25+
id: bump
26+
2427
- name: Commit and push
2528
run: |
2629
git config user.name "AVSlabBot"
2730
git config user.email "cuavslab@gmail.com"
2831
git commit -a -m "[AUTO] Bump minor version number"
2932
git push
33+
34+
- name: Create tag
35+
if: ${{ steps.bump.outputs.updated_version != '' }}
36+
run: |
37+
git tag -a "v${{ steps.bump.outputs.updated_version }}" \
38+
-m "Release v${{ steps.bump.outputs.updated_version }}"
39+
git push --tags

.github/workflows/version_bumper.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,20 @@ if [[ $version_line =~ $regex ]]; then
2323
last_number=${BASH_REMATCH[2]}
2424
incremented_number=$((last_number + 1))
2525
updated_version=${BASH_REMATCH[1]}$incremented_number
26-
26+
2727
# Update the version in the pyproject.toml file
2828
sed -i "s/version = \"${BASH_REMATCH[1]}${last_number}\"/version = \"$updated_version\"/" "$file"
29-
29+
3030
echo "Version updated to $updated_version in $file"
3131
else
3232
echo "Error: Version not found in $file or not in X.Y.Z format"
3333
exit 1
34-
fi
34+
fi
35+
36+
37+
# Expose the update versions to GitHub Actions
38+
if [[ -n "${GITHUB_OUTPUT:-}" ]]; then
39+
{
40+
echo "updated_version=$updated_version"
41+
} >> "$GITHUB_OUTPUT"
42+
fi

0 commit comments

Comments
 (0)