use hatch version
This commit is contained in:
parent
82102c4adf
commit
2f16036c8e
1 changed files with 34 additions and 51 deletions
79
justfile
79
justfile
|
|
@ -3,7 +3,7 @@ delete-tag:
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# Get the version
|
# Get the version
|
||||||
VERSION=$(cat version)
|
VERSION=$(hatch version)
|
||||||
|
|
||||||
# Delete the tag
|
# Delete the tag
|
||||||
git tag -d "v$VERSION"
|
git tag -d "v$VERSION"
|
||||||
|
|
@ -14,83 +14,66 @@ delete-release:
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# Get the version
|
# Get the version
|
||||||
VERSION=$(cat version)
|
VERSION=$(hatch version)
|
||||||
|
|
||||||
# Delete the release
|
# Delete the release
|
||||||
gh release delete "v$VERSION"
|
gh release delete "v$VERSION"
|
||||||
|
|
||||||
create-tag:
|
create-tag:
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
VERSION=$(cat version)
|
VERSION=$(hatch version)
|
||||||
git tag -a "v$VERSION" -m "Release v$VERSION"
|
git tag -a "v$VERSION" -m "Release v$VERSION"
|
||||||
git push origin "v$VERSION"
|
git push origin "v$VERSION"
|
||||||
|
|
||||||
create-archives:
|
create-archives:
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
VERSION=$(cat version)
|
VERSION=$(hatch version)
|
||||||
rm -rf dist build
|
rm -rf dist build
|
||||||
mkdir -p dist
|
hatch build -t binary
|
||||||
|
|
||||||
|
krayt_bin=dist/binary/krayt-${VERSION}
|
||||||
|
|
||||||
# Create the binary for each platform
|
# Create the binary for each platform
|
||||||
for platform in "x86_64-unknown-linux-gnu" "aarch64-unknown-linux-gnu"; do
|
for platform in "x86_64-unknown-linux-gnu" "aarch64-unknown-linux-gnu"; do
|
||||||
outdir="krayt-${VERSION}-${platform}"
|
outbin="krayt-${VERSION}-${platform}"
|
||||||
mkdir -p "dist/${outdir}"
|
|
||||||
|
|
||||||
# Copy the Python script and update version
|
# Copy the Python script and update version
|
||||||
cp krayt.py "dist/${outdir}/krayt.py"
|
cp ${krayt_bin} "dist/binary/${outbin}"
|
||||||
sed -i "s/NIGHTLY/${VERSION}/" "dist/${outdir}/krayt.py"
|
|
||||||
|
|
||||||
cd dist
|
|
||||||
tar czf "${outdir}.tar.gz" "${outdir}"
|
|
||||||
sha256sum "${outdir}.tar.gz" > "${outdir}.tar.gz.sha256"
|
|
||||||
cd ..
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# Generate install.sh
|
# Generate install.sh
|
||||||
./scripts/generate_install_script.py "$VERSION"
|
# ./scripts/generate_install_script.py "$VERSION"
|
||||||
chmod +x dist/install.sh
|
# chmod +x dist/install.sh
|
||||||
|
|
||||||
create-release: create-tag create-archives
|
# create-release: create-archives
|
||||||
|
create-release:
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
VERSION=$(cat version)
|
VERSION=$(hatch version)
|
||||||
./scripts/get_release_notes.py "$VERSION" > release_notes.tmp
|
./scripts/get_release_notes.py "$VERSION" > release_notes.tmp
|
||||||
|
|
||||||
|
# Check if release already exists
|
||||||
|
if gh release view "v$VERSION" &>/dev/null; then
|
||||||
|
echo "Release v$VERSION already exists. Uploading binaries..."
|
||||||
|
# Upload binaries to existing release
|
||||||
|
gh release upload "v$VERSION" \
|
||||||
|
dist/binary/krayt-${VERSION} \
|
||||||
|
dist/binary/krayt-${VERSION}-aarch64-unknown-linux-gnu \
|
||||||
|
dist/binary/krayt-${VERSION}-x86_64-unknown-linux-gnu || true
|
||||||
|
else
|
||||||
|
echo "Creating new release v$VERSION"
|
||||||
|
# Create new release with binaries
|
||||||
gh release create "v$VERSION" \
|
gh release create "v$VERSION" \
|
||||||
--title "v$VERSION" \
|
--title "v$VERSION" \
|
||||||
--notes-file release_notes.tmp \
|
--notes-file release_notes.tmp \
|
||||||
dist/krayt-${VERSION}-x86_64-unknown-linux-gnu.tar.gz \
|
dist/binary/krayt-${VERSION} \
|
||||||
dist/krayt-${VERSION}-x86_64-unknown-linux-gnu.tar.gz.sha256 \
|
dist/binary/krayt-${VERSION}-aarch64-unknown-linux-gnu \
|
||||||
dist/krayt-${VERSION}-aarch64-unknown-linux-gnu.tar.gz \
|
dist/binary/krayt-${VERSION}-x86_64-unknown-linux-gnu
|
||||||
dist/krayt-${VERSION}-aarch64-unknown-linux-gnu.tar.gz.sha256 \
|
fi
|
||||||
dist/install.sh
|
|
||||||
rm release_notes.tmp
|
rm release_notes.tmp
|
||||||
|
|
||||||
preview-release-notes:
|
preview-release-notes:
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
VERSION=$(cat version)
|
VERSION=$(hatch version)
|
||||||
./scripts/get_release_notes.py "$VERSION" | less -R
|
./scripts/get_release_notes.py "$VERSION" | less -R
|
||||||
|
|
||||||
release: create-release
|
release: create-release
|
||||||
|
|
||||||
build-pyapp:
|
|
||||||
export PYAPP_PROJECT_NAME=krayt
|
|
||||||
export PYAPP_PROJECT_VERSION=`hatch version`
|
|
||||||
export PYAPP_DISTRIBUTION_SOURCE=~/git/krayt/dist/krayt-${PYAPP_PROJECT_VERSION}.tar.gz
|
|
||||||
export PYAPP_DISTRIBUTION_EMBED=true
|
|
||||||
|
|
||||||
|
|
||||||
echo "linting"
|
|
||||||
hatch run lint-format
|
|
||||||
|
|
||||||
echo "Building pyapp"
|
|
||||||
hatch build
|
|
||||||
|
|
||||||
echo "Uploading pyapp"
|
|
||||||
hatch publish
|
|
||||||
|
|
||||||
cd ~/git/pyapp
|
|
||||||
cargo build --release --quiet
|
|
||||||
|
|
||||||
|
|
||||||
echo "Done"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue