Skip to content

Commit fc05998

Browse files
Merge pull request #33 from mindfiredigital/master
Merge master into main
2 parents f710b62 + 4ee7503 commit fc05998

File tree

2 files changed

+34
-54
lines changed

2 files changed

+34
-54
lines changed

.github/workflows/release-and-publish.yml

Lines changed: 18 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- name: Install dependencies
2929
run: |
3030
python -m pip install --upgrade pip
31-
pip install build twine python-semantic-release setuptools-scm
31+
pip install build twine python-semantic-release>=9.0.0 setuptools-scm
3232
3333
- name: Create release branch
3434
run: |
@@ -37,14 +37,19 @@ jobs:
3737
git checkout -b release-main
3838
git push --set-upstream origin release-main
3939
40-
- name: Run semantic-release
40+
- name: Run semantic-release version on release-main branch
4141
env:
4242
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43-
# Set the branch via environment variable
44-
SEMANTIC_RELEASE_BRANCH: release-main
4543
run: |
46-
semantic-release version
47-
semantic-release publish
44+
semantic-release --verbose version
45+
46+
# For semantic-release 9.x, the publish command needs to be run separately
47+
- name: Run semantic-release publish
48+
env:
49+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
51+
run: |
52+
semantic-release --verbose publish
4853
4954
- name: Push release branch
5055
run: git push origin release-main
@@ -59,46 +64,13 @@ jobs:
5964
--title "Automated Release Updates" \
6065
--body "This pull request contains updates from the semantic-release process." || true
6166
62-
- name: Build package
63-
run: python -m build
64-
65-
- name: Publish package to PyPI
67+
# This is only needed if semantic-release publish didn't handle the PyPI upload
68+
- name: Build and publish package to PyPI if needed
6669
env:
6770
TWINE_USERNAME: __token__
6871
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
69-
run: twine upload dist/*
70-
# create-pr-back-to-master:
71-
# needs: release
72-
# runs-on: ubuntu-latest
73-
# permissions:
74-
# contents: write
75-
# pull-requests: write
76-
# steps:
77-
# - name: Checkout code
78-
# uses: actions/checkout@v3
79-
# with:
80-
# fetch-depth: 0
81-
# ref: main
82-
83-
# - name: Set Git Identity
84-
# run: |
85-
# git config --global user.name 'GitHub Actions'
86-
# git config --global user.email 'github-actions@github.com'
87-
88-
# - name: Create Pull Request from main to master
89-
# env:
90-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91-
# run: |
92-
# git fetch origin master:refs/remotes/origin/master
93-
# DIFF_COUNT=$(git rev-list --count origin/master..HEAD)
94-
# if [ "$DIFF_COUNT" -gt 0 ]; then
95-
# echo "Differences found between main and master. Creating PR..."
96-
# gh pr create \
97-
# --base master \
98-
# --head main \
99-
# --title "Sync master with main after release" \
100-
# --body "This is an automated PR to sync changes from main back to master after a release." || true
101-
# echo "Pull request created or already exists."
102-
# else
103-
# echo "No differences found between main and master. Skipping PR creation."
104-
# fi
72+
run: |
73+
if [ ! -f "dist/*" ]; then
74+
python -m build
75+
twine upload dist/*
76+
fi

pyproject.toml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
[build-system]
32
requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=6.0"]
43
build-backend = "setuptools.build_meta"
@@ -9,16 +8,25 @@ local_scheme = "no-local-version"
98

109
[tool.semantic_release]
1110
version_source = "tag"
12-
upload_to_pypi = true
1311
commit = false
1412
push = false
13+
upload_to_pypi = true
14+
build_command = "python -m build"
1515

16-
[tool.semantic_release.release_groups]
17-
default = { branches = ["release-main"] }
16+
# This is the key configuration for version 9.x
17+
[tool.semantic_release.branches.release-main]
18+
match = "release-main"
19+
prerelease = false
1820

21+
# The following configurations are optional but recommended
1922
[tool.semantic_release.publish]
20-
repository = "pypi"
23+
upload_to_release = true
24+
upload_to_pypi = true
25+
dist_glob_patterns = ["dist/*"]
26+
27+
[tool.semantic_release.remote.token]
28+
env = "GH_TOKEN"
2129

22-
[tool.semantic_release.options]
23-
patch_without_tag = false
24-
allowed_tags = "(a|alpha|b|beta|rc)"
30+
[tool.semantic_release.remote]
31+
type = "github"
32+
ignore_token_for_push = false

0 commit comments

Comments
 (0)