Skip to content

Commit ee3299e

Browse files
committed
Updating the automation
1 parent 5f1d494 commit ee3299e

5 files changed

Lines changed: 50 additions & 38 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: checkout-and-setup-python
2+
description: 'Checkout the repository and setup Python'
3+
inputs:
4+
python-version:
5+
description: 'Python version to use'
6+
required: false
7+
default: '3.11'
8+
git-ref:
9+
description: 'Git ref to checkout'
10+
required: false
11+
default: ""
12+
runs:
13+
using: 'composite'
14+
steps:
15+
- uses: actions/checkout@v4
16+
name: Checkout the repository
17+
with:
18+
fetch-depth: 0
19+
ref: ${{ inputs.git-ref }}
20+
token: ${{ secrets.PAT }}
21+
22+
- uses: actions/setup-python@v4
23+
name: Setup Python
24+
with:
25+
python-version: ${{ inputs.python-version }}
26+
cache: 'pip' # caching pip dependencies
27+
28+
- name: Git check
29+
run: |
30+
git config --global user.email "bump-my-version@github.actions"
31+
git config --global user.name "Testing Git"
32+
git --version
33+
git config --list
34+
shell: bash

.github/workflows/bumpversion-pr.yaml

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,16 @@ jobs:
88
bumpversion:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v4
12-
with:
13-
fetch-depth: 0
14-
ref: ${{ github.event.pull_request.head.sha }}
15-
token: ${{ secrets.PAT }}
16-
17-
- uses: actions/setup-python@v4
11+
- name: Checkout and setup Python
12+
uses: ./.github/actions/checkout-and-setup-python
1813
with:
1914
python-version: '3.11'
20-
cache: 'pip' # caching pip dependencies
15+
git-ref: ${{ github.event.pull_request.head.sha }}
2116

2217
- name: Install requirements
2318
run: |
2419
python -m pip install . bump-my-version
2520
26-
- name: Git check
27-
run: |
28-
git config --global user.email "no-reply@github.actions"
29-
git config --global user.name "Testing Git"
30-
git --version
31-
git config --list
32-
3321
- name: Get the release hint
3422
id: generate-changelog
3523
run: |
@@ -38,7 +26,7 @@ jobs:
3826
echo "RELEASE_KIND=$RELEASE_KIND" >> $GITHUB_ENV
3927
echo "release-kind=$RELEASE_KIND" >> $GITHUB_OUTPUT
4028
41-
- name: Bump Version dry run
29+
- name: Bump version dry run
4230
if: ${{ env.RELEASE_KIND != 'no-release' }}
4331
shell: bash
4432
run: |

.github/workflows/bumpversion.yaml

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,15 @@ jobs:
88
version-hint:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v4
12-
with:
13-
fetch-depth: 0
14-
token: ${{ secrets.PAT }}
15-
16-
- uses: actions/setup-python@v4
11+
- name: Checkout and setup Python
12+
uses: ./.github/actions/checkout-and-setup-python
1713
with:
1814
python-version: '3.11'
19-
cache: 'pip' # caching pip dependencies
2015

2116
- name: Install requirements
2217
run: |
2318
python -m pip install . bump-my-version
2419
25-
- name: Git check
26-
run: |
27-
git config --global user.email "bump-my-version@github.actions"
28-
git config --global user.name "Testing Git"
29-
git --version
30-
git config --list
31-
3220
- name: Generate the changelog and get the release hint
3321
id: generate-changelog
3422
run: |
@@ -38,7 +26,8 @@ jobs:
3826
echo "release-kind=$RELEASE_KIND" >> $GITHUB_OUTPUT
3927
echo "PACKAGE=false" >> $GITHUB_ENV
4028
41-
- name: Bump Version auto
29+
- name: Bump version
30+
if: ${{ env.RELEASE_KIND != 'no-release' }}
4231
shell: bash
4332
run: |
4433
PR_NUMBER=$(gh pr view --json number -q .number || echo "")

.github/workflows/publish-docs.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ jobs:
1111
publish-docs:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v4
15-
- name: Set up Python
16-
uses: actions/setup-python@v4
14+
- name: Checkout and setup Python
15+
uses: ./.github/actions/checkout-and-setup-python
1716
with:
18-
python-version: '3.x'
17+
python-version: '3.11'
1918
- name: Install dependencies
2019
run: |
2120
python -m pip install --upgrade pip

.github/workflows/release.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ jobs:
88
release:
99
name: Create a GitHub release
1010
runs-on: ubuntu-latest
11-
needs: build-package
1211
steps:
13-
- uses: actions/checkout@v3
12+
- name: Checkout and setup Python
13+
uses: ./.github/actions/checkout-and-setup-python
14+
with:
15+
python-version: '3.11'
1416
- name: Parse changelog
1517
shell: bash
1618
run: |
@@ -47,6 +49,7 @@ jobs:
4749
with:
4850
name: Packages
4951
path: dist
52+
if-no-files-found: warn
5053

5154
- name: Release
5255
uses: softprops/action-gh-release@v1
@@ -58,7 +61,6 @@ jobs:
5861
# Upload to real PyPI on GitHub Releases.
5962
release-pypi:
6063
name: Publish released package to pypi.org
61-
if: startsWith(github.ref, 'refs/tags/')
6264
runs-on: ubuntu-latest
6365
needs: build-package
6466
steps:

0 commit comments

Comments
 (0)