Skip to content

Commit 4150c6e

Browse files
anna-singleton-resolveranna-singleton-resolveriwillspeak
authored
ci: build and publish pre release version to pypy (#91)
* ci: build and publish pre release version to pypy * fix: dont shallow copy - we need tags and history for pre-releases * fix: syntax * fix: semver * fix: tr syntax * fix: python doesnt permit SemVer --------- Co-authored-by: anna-singleton-resolver <anna.singleton@resolver.com> Co-authored-by: Will Speak <lithiumflame@gmail.com>
1 parent bda2a25 commit 4150c6e

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
push:
55
branches:
66
- main
7+
- feature/*
8+
- fix/*
79
pull_request:
810
branches:
911
- main
@@ -82,6 +84,10 @@ jobs:
8284

8385
steps:
8486
- uses: actions/checkout@v6
87+
with:
88+
# required for guessing versioning for pre-releases
89+
fetch-depth: 0
90+
fetch-tags: true
8591

8692
- name: Initialize submodules
8793
run: git submodule update --init --recursive
@@ -111,7 +117,14 @@ jobs:
111117
echo "Setting version to: $VERSION"
112118
uv version "$VERSION"
113119
else
114-
echo "Not building from a tag, using default version"
120+
if [[ "$GITHUB_REF" == refs/heads/main ]]; then
121+
echo "On main branch, using default version"
122+
else
123+
# we want to build pre-release versioning for other branches, but only feature/* and fix/* will get published.
124+
LAST_TAG=$(git describe --abbrev=0 --tags)
125+
uv version "$LAST_TAG"
126+
uv version --bump patch --bump dev="$(date +%Y%m%d%H%M%S)"
127+
fi
115128
fi
116129
117130
- name: Build package
@@ -126,7 +139,11 @@ jobs:
126139
publish:
127140
needs: [test, build]
128141
runs-on: ubuntu-latest
129-
if: github.event_name == 'release' && github.event.action == 'published'
142+
if: >
143+
(github.event_name == 'release' && github.event.action == 'published') ||
144+
(github.event_name == 'push' && (
145+
startsWith(github.ref, 'refs/heads/feature') ||
146+
startsWith(github.ref, 'refs/heads/fix')))
130147
environment:
131148
name: pypi
132149
url: https://pypi.org/p/resolver-athena-client

0 commit comments

Comments
 (0)