forked from Flexget/Flexget
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease.sh
executable file
·56 lines (45 loc) · 1.65 KB
/
release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
# This should only be run on develop branch. Builds and releases to pypi.
# Also updates version numbers, creates a release tag, then pushes the new develop and release branches to github.
# Exit if any command fails
set -e
# Show commands executing
set -x
# Error if running on a branch other than develop
if [ "$(git rev-parse HEAD)" != "$(git rev-parse origin/develop)" ]; then
echo "Release script should be run from develop branch."
exit 1
fi
# Only run if there are new commits
if git log --skip 1 origin/master..origin/develop|grep '^commit '; then
# Bump to new release version
uv run dev_tools.py bump-version release
VERSION=$(uv run dev_tools.py version)
export VERSION
uv lock --upgrade-package flexget
# Build and upload to pypi.
# Enabling hatch hooks bundles the webui.
HATCH_BUILD_HOOKS_ENABLE=true uv build
uv publish
# Commit and tag released version
git add flexget/_version.py
git add uv.lock
git commit -m "v${VERSION}"
git tag -a -f "v${VERSION}" -m "v${VERSION} release"
# Save tag name to github actions environment
echo "release_tag=v${VERSION}" >> $GITHUB_ENV
# Bump to new dev version, then commit again
uv run dev_tools.py bump-version dev
uv lock --upgrade-package flexget
git add flexget/_version.py
git add uv.lock
git commit -m "Prepare v$(uv run dev_tools.py version)"
# master branch should be at the release we tagged
git branch -f master v${VERSION}
# If either of the new branches are not fast forwards, the push will be rejected
git push origin master develop
# Make sure our branches push before pushing tag
git push --tags
else
echo "No commits, skipping release"
fi