Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
VERSION_TO_BUMP: ${{ inputs.versionToBump }}
GH_TOKEN: ${{ github.token }}
- run: rm -Rf node_modules
- run: uv build --sdist
- run: uv build
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
Expand Down
7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,8 @@ Repository = "https://github.com/seatsio/seatsio-python/"
Issues = "https://github.com/seatsio/seatsio-python/issues"

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"

[tool.setuptools.packages.find]
include = ["seatsio*"]
26 changes: 13 additions & 13 deletions release.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,21 @@ async function determineNextVersionNumber(previous) {
return semver.inc(previous, versionToBump)
}

async function bumpVersionInFiles() {
await replaceInFile("pyproject.toml", `version = "${latestVersion}"`, `version = "${nextVersion}"`)
async function ensurePyProjectVersionMatchesTheLatestTag() {
const pyproject = await fs.readFile("pyproject.toml", "utf8")
const match = pyproject.match(/^\s*version\s*=\s*"([^"]+)"\s*$/m)
if (!match) throw new Error("Could not find version in pyproject.toml")
const currentVersion = match[1]
if (currentVersion !== latestVersion) {
throw new Error(`pyproject.toml version (${currentVersion}) does not match latest release tag (${latestVersion})`)
}
}

async function replaceInFile(filename, latestVersion, nextVersion) {
return await fs.readFile(filename, 'utf8')
.then(text => {
if (text.indexOf(latestVersion) < 0) {
throw new Error('Not the correct version. Could not find ' + latestVersion + ' in ' + filename)
}
return text
})
.then(text => text.replace(latestVersion, nextVersion))
.then(text => fs.writeFileSync(filename, text))
.then(() => gitAdd(filename))
async function bumpVersionInFiles() {
await ensurePyProjectVersionMatchesTheLatestTag()
await $`uv version ${nextVersion}`
await gitAdd("pyproject.toml")
await gitAdd("uv.lock")
}

async function gitAdd(filename) {
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.