Split the versioning of the lib and cli (in theory)
This commit is contained in:
parent
aeab4159d4
commit
149b9b9821
|
@ -1,9 +1,9 @@
|
||||||
name: Release
|
name: CLI Release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- "*.*.*"
|
- "cli-v*.*.*"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
@ -102,7 +102,7 @@ jobs:
|
||||||
ext=""
|
ext=""
|
||||||
[[ "${{ matrix.name }}" == windows-* ]] && ext=".exe"
|
[[ "${{ matrix.name }}" == windows-* ]] && ext=".exe"
|
||||||
bin="target/${{ matrix.target }}/release/watchexec${ext}"
|
bin="target/${{ matrix.target }}/release/watchexec${ext}"
|
||||||
version=$(echo "${{ github.ref }}" | cut -d/ -f3 | cut -dv -f2)
|
version=$(grep -oP '[0-9.]+' <<< "${{ github.ref }}")
|
||||||
dst="watchexec-${version}-${{ matrix.target }}"
|
dst="watchexec-${version}-${{ matrix.target }}"
|
||||||
mkdir "$dst"
|
mkdir "$dst"
|
||||||
strip "$bin" || true
|
strip "$bin" || true
|
||||||
|
@ -113,7 +113,7 @@ jobs:
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -euxo pipefail
|
set -euxo pipefail
|
||||||
version=$(echo "${{ github.ref }}" | cut -d/ -f3 | cut -dv -f2)
|
version=$(grep -oP '[0-9.]+' <<< "${{ github.ref }}")
|
||||||
dst="watchexec-${version}-${{ matrix.target }}"
|
dst="watchexec-${version}-${{ matrix.target }}"
|
||||||
tar cavf "$dst.tar.xz" "$dst"
|
tar cavf "$dst.tar.xz" "$dst"
|
||||||
- name: Archive (deb)
|
- name: Archive (deb)
|
||||||
|
@ -121,7 +121,7 @@ jobs:
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -euxo pipefail
|
set -euxo pipefail
|
||||||
version=$(echo "${{ github.ref }}" | cut -d/ -f3 | cut -dv -f2)
|
version=$(grep -oP '[0-9.]+' <<< "${{ github.ref }}")
|
||||||
dst="watchexec-${version}-${{ matrix.target }}"
|
dst="watchexec-${version}-${{ matrix.target }}"
|
||||||
mkdir -p "deb/$dst"
|
mkdir -p "deb/$dst"
|
||||||
cd "deb/$dst"
|
cd "deb/$dst"
|
||||||
|
@ -150,7 +150,7 @@ jobs:
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -euxo pipefail
|
set -euxo pipefail
|
||||||
version=$(echo "${{ github.ref }}" | cut -d/ -f3 | cut -dv -f2)
|
version=$(grep -oP '[0-9.]+' <<< "${{ github.ref }}")
|
||||||
dst="watchexec-${version}-${{ matrix.target }}"
|
dst="watchexec-${version}-${{ matrix.target }}"
|
||||||
7z a "$dst.zip" "$dst"
|
7z a "$dst.zip" "$dst"
|
||||||
- uses: softprops/action-gh-release@v1
|
- uses: softprops/action-gh-release@v1
|
||||||
|
|
|
@ -74,8 +74,8 @@ A release goes through these steps:
|
||||||
|
|
||||||
8. Check for any dependency updates with `cargo outdated -R`.
|
8. Check for any dependency updates with `cargo outdated -R`.
|
||||||
|
|
||||||
9. Run `bin/version 1.2.3` where `1.2.3` is the new version number. This will tag and push,
|
9. Run `bin/cli-version 1.2.3` where `1.2.3` is the new version number. This will tag and push,
|
||||||
triggering the GitHub Action for releases.
|
triggering the GitHub Action for releases. Use `bin/lib-version` to release a library update.
|
||||||
|
|
||||||
10. Wait for all builds to complete, then attach the draft release to the tag, and publish it.
|
10. Wait for all builds to complete, then attach the draft release to the tag, and publish it.
|
||||||
|
|
||||||
|
|
|
@ -42,12 +42,11 @@ echo "Next version to be $newver ($date), creating..."
|
||||||
|
|
||||||
sed -E -i "s/version=\"$extver.0\"/version=\"$newver.0\"/1" cli/watchexec.exe.manifest
|
sed -E -i "s/version=\"$extver.0\"/version=\"$newver.0\"/1" cli/watchexec.exe.manifest
|
||||||
sed -E -i "s/^version = \"$extver\"/version = \"$newver\"/1" cli/Cargo.toml
|
sed -E -i "s/^version = \"$extver\"/version = \"$newver\"/1" cli/Cargo.toml
|
||||||
sed -E -i "s/^version = \"$extver\"/version = \"$newver\"/1" lib/Cargo.toml
|
|
||||||
|
|
||||||
cargo check
|
cargo check
|
||||||
|
|
||||||
git commit -am "$newver"
|
git commit -am "cli: v$newver"
|
||||||
git tag -sam "$newver" "$newver"
|
git tag -sam "watchexec-cli $newver" "cli-v$newver"
|
||||||
|
|
||||||
echo "Pushing to upstream"
|
echo "Pushing to upstream"
|
||||||
git push --follow-tags $upstream $mainbranch
|
git push --follow-tags $upstream $mainbranch
|
|
@ -0,0 +1,51 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
app="watchexec"
|
||||||
|
mainbranch="main"
|
||||||
|
upstream_rx="watchexec/"
|
||||||
|
|
||||||
|
curbranch=$(git rev-parse --abbrev-ref HEAD)
|
||||||
|
if [[ "$curbranch" != "$mainbranch" ]]; then
|
||||||
|
echo "Current branch is not $mainbranch, abort!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
gitstatus=$(git status --untracked-files=no --porcelain)
|
||||||
|
if [[ ! -z "$gitstatus" ]]; then
|
||||||
|
echo "Uncommited files and changes, abort!"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
upstream=$(git remote -v | grep -i "$upstream_rx" -m1 | awk '{print $1}')
|
||||||
|
echo "Upstream remote discovered as: $upstream"
|
||||||
|
|
||||||
|
echo "Pulling from upstream"
|
||||||
|
git pull --rebase --autostash $upstream $mainbranch
|
||||||
|
|
||||||
|
echo "Fetching tags from upstream"
|
||||||
|
git fetch --tags "$upstream"
|
||||||
|
|
||||||
|
extver=$(grep -P '^version =' lib/Cargo.toml | head -n1 | cut -d'"' -f2)
|
||||||
|
echo "(Version from lib/Cargo.toml: $extver)"
|
||||||
|
|
||||||
|
newver="$1"
|
||||||
|
|
||||||
|
if [[ "$newver" == "$extver" ]]; then
|
||||||
|
echo "New and existing versions are the same, abort!"
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
|
||||||
|
date=$(date +%Y-%m-%d)
|
||||||
|
echo "Next version to be $newver ($date), creating..."
|
||||||
|
|
||||||
|
sed -E -i "s/^version = \"$extver\"/version = \"$newver\"/1" lib/Cargo.toml
|
||||||
|
|
||||||
|
cargo check
|
||||||
|
|
||||||
|
git commit -am "lib: v$newver"
|
||||||
|
git tag -sam "watchexec $newver" "lib-v$newver"
|
||||||
|
|
||||||
|
echo "Pushing to upstream"
|
||||||
|
git push --follow-tags $upstream $mainbranch
|
|
@ -37,10 +37,10 @@ features = []
|
||||||
embed-resource = "1.6.1"
|
embed-resource = "1.6.1"
|
||||||
|
|
||||||
[package.metadata.binstall]
|
[package.metadata.binstall]
|
||||||
pkg-url = "{ repo }/releases/download/{ version }/watchexec-{ version }-{ target }.tar.xz"
|
pkg-url = "{ repo }/releases/download/cli-v{ version }/watchexec-{ version }-{ target }.tar.xz"
|
||||||
bin-dir = "watchexec-{ version }-{ target }/{ bin }{ format }"
|
bin-dir = "watchexec-{ version }-{ target }/{ bin }{ format }"
|
||||||
pkg-fmt = "txz"
|
pkg-fmt = "txz"
|
||||||
|
|
||||||
[package.metadata.binstall.overrides.x86_64-pc-windows-msvc]
|
[package.metadata.binstall.overrides.x86_64-pc-windows-msvc]
|
||||||
pkg-url = "{ repo }/releases/download/{ version }/watchexec-{ version }-{ target }.zip"
|
pkg-url = "{ repo }/releases/download/cli-v{ version }/watchexec-{ version }-{ target }.zip"
|
||||||
pkg-fmt = "zip"
|
pkg-fmt = "zip"
|
||||||
|
|
|
@ -32,10 +32,10 @@ version = "0.3.9"
|
||||||
features = ["ioapiset", "jobapi2", "tlhelp32"]
|
features = ["ioapiset", "jobapi2", "tlhelp32"]
|
||||||
|
|
||||||
[package.metadata.binstall]
|
[package.metadata.binstall]
|
||||||
pkg-url = "{ repo }/releases/download/{ version }/watchexec-{ version }-{ target }.tar.xz"
|
pkg-url = "{ repo }/releases/download/cli-v{ version }/watchexec-{ version }-{ target }.tar.xz"
|
||||||
bin-dir = "watchexec-{ version }-{ target }/{ bin }{ format }"
|
bin-dir = "watchexec-{ version }-{ target }/{ bin }{ format }"
|
||||||
pkg-fmt = "txz"
|
pkg-fmt = "txz"
|
||||||
|
|
||||||
[package.metadata.binstall.overrides.x86_64-pc-windows-msvc]
|
[package.metadata.binstall.overrides.x86_64-pc-windows-msvc]
|
||||||
pkg-url = "{ repo }/releases/download/{ version }/watchexec-{ version }-{ target }.zip"
|
pkg-url = "{ repo }/releases/download/cli-v{ version }/watchexec-{ version }-{ target }.zip"
|
||||||
pkg-fmt = "zip"
|
pkg-fmt = "zip"
|
||||||
|
|
Loading…
Reference in New Issue