Skip to content

Commit edbf674

Browse files
ci: add publishing and tagging when library version changes
1 parent 7fdee31 commit edbf674

File tree

4 files changed

+200
-0
lines changed

4 files changed

+200
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Publish to PyPI - garf-core
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'libs/core/**'
9+
- '!libs/core/**/*.md'
10+
11+
jobs:
12+
publish:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v4
21+
22+
- name: Get versions and check for change
23+
id: version_check
24+
run: |
25+
PREV_VERSION=$(git show HEAD~1:libs/core/garf_core/__init__.py | grep -oE "__version__ = '([0-9]+\.[0-9]+\.[0-9]+)'" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
26+
CURRENT_VERSION=$(grep -oE "__version__ = '([0-9]+\.[0-9]+\.[0-9]+)'" libs/core/garf_core/__init__.py | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
27+
28+
if [[ "$CURRENT_VERSION" != "$PREV_VERSION" ]]; then
29+
echo "Version change detected: $PREV_VERSION -> $CURRENT_VERSION"
30+
echo "should_publish=true" >> $GITHUB_OUTPUT
31+
echo "new_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
32+
else
33+
echo "No version change. Skipping publish."
34+
echo "should_publish=false" >> $GITHUB_OUTPUT
35+
fi
36+
37+
- name: Build the package
38+
if: steps.version_check.outputs.should_publish == 'true'
39+
run: uv build backend
40+
41+
- name: Publish to PyPI
42+
if: steps.version_check.outputs.should_publish == 'true'
43+
run: uv publish backend/dist/*
44+
- name: Create Git Tag
45+
if: steps.version_check.outputs.should_publish == 'true'
46+
run: |
47+
git config --local user.email "action@github.com"
48+
git config --local user.name "GitHub Action"
49+
git tag v${{ steps.version_check.outputs.new_version }}-core
50+
git push origin v${{ steps.version_check.outputs.new_version }}-core
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Publish to PyPI - garf-executors
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'libs/executors/**'
9+
- '!libs/executors/**/*.md'
10+
11+
jobs:
12+
publish:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v4
21+
22+
- name: Get versions and check for change
23+
id: version_check
24+
run: |
25+
PREV_VERSION=$(git show HEAD~1:libs/executors/garf_executors/__init__.py | grep -oE "__version__ = '([0-9]+\.[0-9]+\.[0-9]+)'" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
26+
CURRENT_VERSION=$(grep -oE "__version__ = '([0-9]+\.[0-9]+\.[0-9]+)'" libs/executors/garf_executors/__init__.py | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
27+
28+
if [[ "$CURRENT_VERSION" != "$PREV_VERSION" ]]; then
29+
echo "Version change detected: $PREV_VERSION -> $CURRENT_VERSION"
30+
echo "should_publish=true" >> $GITHUB_OUTPUT
31+
echo "new_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
32+
else
33+
echo "No version change. Skipping publish."
34+
echo "should_publish=false" >> $GITHUB_OUTPUT
35+
fi
36+
37+
- name: Build the package
38+
if: steps.version_check.outputs.should_publish == 'true'
39+
run: uv build backend
40+
41+
- name: Publish to PyPI
42+
if: steps.version_check.outputs.should_publish == 'true'
43+
run: uv publish backend/dist/*
44+
- name: Create Git Tag
45+
if: steps.version_check.outputs.should_publish == 'true'
46+
run: |
47+
git config --local user.email "action@github.com"
48+
git config --local user.name "GitHub Action"
49+
git tag v${{ steps.version_check.outputs.new_version }}-executors
50+
git push origin v${{ steps.version_check.outputs.new_version }}-executors
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Publish to PyPI - garf-youtube-data-api
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'libs/community/google/youtube/youtube-data-api/**'
9+
- '!libs/community/google/youtube/youtube-data-api/*.md'
10+
11+
jobs:
12+
publish:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v4
21+
22+
- name: Get versions and check for change
23+
id: version_check
24+
run: |
25+
PREV_VERSION=$(git show HEAD~1:libs/community/google/youtube/youtube-data-api/garf_youtube_data_api/__init__.py | grep -oE "__version__ = '([0-9]+\.[0-9]+\.[0-9]+)'" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
26+
CURRENT_VERSION=$(grep -oE "__version__ = '([0-9]+\.[0-9]+\.[0-9]+)'" libs/community/google/youtube/youtube-data-api/garf_youtube_data_api/__init__.py | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
27+
28+
if [[ "$CURRENT_VERSION" != "$PREV_VERSION" ]]; then
29+
echo "Version change detected: $PREV_VERSION -> $CURRENT_VERSION"
30+
echo "should_publish=true" >> $GITHUB_OUTPUT
31+
echo "new_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
32+
else
33+
echo "No version change. Skipping publish."
34+
echo "should_publish=false" >> $GITHUB_OUTPUT
35+
fi
36+
37+
- name: Build the package
38+
if: steps.version_check.outputs.should_publish == 'true'
39+
run: uv build backend
40+
41+
- name: Publish to PyPI
42+
if: steps.version_check.outputs.should_publish == 'true'
43+
run: uv publish backend/dist/*
44+
- name: Create Git Tag
45+
if: steps.version_check.outputs.should_publish == 'true'
46+
run: |
47+
git config --local user.email "action@github.com"
48+
git config --local user.name "GitHub Action"
49+
git tag v${{ steps.version_check.outputs.new_version }}-yt-data-api
50+
git push origin v${{ steps.version_check.outputs.new_version }}-yt-data-api
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Publish to PyPI - garf-io
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'libs/io/**'
9+
- '!libs/io/**/*.md'
10+
11+
jobs:
12+
publish:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v4
21+
22+
- name: Get versions and check for change
23+
id: version_check
24+
run: |
25+
PREV_VERSION=$(git show HEAD~1:libs/io/garf_io/__init__.py | grep -oE "__version__ = '([0-9]+\.[0-9]+\.[0-9]+)'" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
26+
CURRENT_VERSION=$(grep -oE "__version__ = '([0-9]+\.[0-9]+\.[0-9]+)'" libs/io/garf_io/__init__.py | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
27+
28+
if [[ "$CURRENT_VERSION" != "$PREV_VERSION" ]]; then
29+
echo "Version change detected: $PREV_VERSION -> $CURRENT_VERSION"
30+
echo "should_publish=true" >> $GITHUB_OUTPUT
31+
echo "new_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
32+
else
33+
echo "No version change. Skipping publish."
34+
echo "should_publish=false" >> $GITHUB_OUTPUT
35+
fi
36+
37+
- name: Build the package
38+
if: steps.version_check.outputs.should_publish == 'true'
39+
run: uv build backend
40+
41+
- name: Publish to PyPI
42+
if: steps.version_check.outputs.should_publish == 'true'
43+
run: uv publish backend/dist/*
44+
- name: Create Git Tag
45+
if: steps.version_check.outputs.should_publish == 'true'
46+
run: |
47+
git config --local user.email "action@github.com"
48+
git config --local user.name "GitHub Action"
49+
git tag v${{ steps.version_check.outputs.new_version }}-io
50+
git push origin v${{ steps.version_check.outputs.new_version }}-io

0 commit comments

Comments
 (0)