Skip to content

Commit 77d897d

Browse files
authored
Merge pull request #47 from gsinghjay/test/verify-workflows
ci: standardize Poetry usage across workflows
2 parents d3798a3 + b809859 commit 77d897d

File tree

4 files changed

+30
-50
lines changed

4 files changed

+30
-50
lines changed

.github/workflows/lint.yml

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,15 @@ jobs:
3333
uses: actions/setup-python@v4
3434
with:
3535
python-version: "3.11"
36-
cache: 'pip'
36+
cache: "pip"
3737

38-
- name: Set up Node (for Commitlint)
39-
uses: actions/setup-node@v3
40-
with:
41-
node-version: 18
42-
cache: 'npm'
43-
44-
- name: Install npm dependencies
38+
- name: Install Poetry
4539
run: |
46-
npm ci
40+
pip install poetry==1.8.5
41+
poetry config virtualenvs.create false
4742
4843
- name: Install dependencies
49-
run: |
50-
python -m pip install --upgrade pip
51-
pip install poetry==1.8.5
52-
poetry install --no-root
44+
run: poetry install
5345

5446
- name: Run Black
5547
run: poetry run black --check .

.github/workflows/release.yml

Lines changed: 16 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,13 @@ permissions:
3030
id-token: write
3131

3232
jobs:
33-
# Call the lint workflow first
3433
lint:
3534
name: Lint Check
3635
uses: ./.github/workflows/lint.yml
3736
permissions:
3837
contents: read
3938
pull-requests: read
4039

41-
# Call the test workflow next
4240
test:
4341
name: Run Tests
4442
needs: [lint]
@@ -47,11 +45,9 @@ jobs:
4745
contents: read
4846
checks: write
4947

50-
# Finally run the release job
5148
release:
5249
name: Create Release
5350
runs-on: ubuntu-latest
54-
# Only run release on main branch and when not triggered by automated commits
5551
if: |
5652
github.ref == 'refs/heads/main' &&
5753
github.actor != 'github-actions[bot]' &&
@@ -66,32 +62,20 @@ jobs:
6662
with:
6763
fetch-depth: 0
6864
token: ${{ secrets.PAT_TOKEN }}
69-
ref: ${{ github.sha }}
7065

71-
- name: Force correct release branch
72-
run: |
73-
git checkout -B ${{ github.ref_name }} ${{ github.sha }}
74-
75-
- name: Setup Python and Dependencies
76-
run: |
77-
pip install python-semantic-release==9.15.0
78-
git config --global user.name "github-actions[bot]"
79-
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
66+
- name: Set up Python
67+
uses: actions/setup-python@v4
68+
with:
69+
python-version: "3.11"
70+
cache: "pip"
8071

81-
- name: Generate Changelog
82-
env:
83-
GH_TOKEN: ${{ secrets.PAT_TOKEN }}
72+
- name: Install Poetry
8473
run: |
85-
# Generate changelog regardless of release
86-
semantic-release changelog
74+
pip install poetry==1.8.5
75+
poetry config virtualenvs.create false
8776
88-
# Commit changelog if changed
89-
if [[ -n $(git status --porcelain CHANGELOG.md) ]]; then
90-
git pull origin ${{ github.ref_name }} --rebase
91-
git add CHANGELOG.md
92-
git commit -m "docs: update CHANGELOG.md [skip ci]"
93-
git push origin HEAD:${{ github.ref_name }}
94-
fi
77+
- name: Install dependencies
78+
run: poetry install
9579

9680
- name: Python Semantic Release
9781
id: release
@@ -103,10 +87,9 @@ jobs:
10387
force: ${{ inputs.force != 'none' && inputs.force || '' }}
10488
git_committer_name: "github-actions[bot]"
10589
git_committer_email: "41898282+github-actions[bot]@users.noreply.github.com"
106-
107-
- name: Publish to GitHub Release Assets
108-
uses: python-semantic-release/publish-action@v9.15.0
109-
if: steps.release.outputs.released == 'true'
110-
with:
111-
github_token: ${{ secrets.PAT_TOKEN }}
112-
tag: ${{ steps.release.outputs.tag }}
90+
changelog: true
91+
commit: true
92+
push: true
93+
build: true
94+
tag: true
95+
vcs_release: true

.github/workflows/test.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,15 @@ jobs:
3636
uses: actions/setup-python@v4
3737
with:
3838
python-version: ${{ matrix.python-version }}
39-
cache: 'pip'
39+
cache: "pip"
4040

41-
- name: Install dependencies
41+
- name: Install Poetry
4242
run: |
43-
python -m pip install --upgrade pip
4443
pip install poetry==1.8.5
45-
poetry install --no-root
44+
poetry config virtualenvs.create false
45+
46+
- name: Install dependencies
47+
run: poetry install
4648

4749
- name: Run tests with coverage
4850
run: |

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ commit_message = "chore(release): {version} [skip ci]"
4747

4848
[tool.python_semantic_release.remote]
4949
token = "env:GH_TOKEN"
50+
# Add these if you want to sign releases
51+
sign_tags = true
52+
provider = "github"
5053

5154
# Simplified branch configuration - only main branch
5255
[tool.python_semantic_release.branches]

0 commit comments

Comments
 (0)