-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 22-unpacked
- Loading branch information
Showing
13 changed files
with
188 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,26 +4,35 @@ name: Generate Manual | |
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
paths: | ||
- 'docs/src/manual.md' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
gen_man: | ||
permissions: | ||
pull-requests: write | ||
contents: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- id: generate | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install pandoc | ||
./man/gen-man | ||
./ci/gen-man | ||
- name: push updated manual | ||
run: | | ||
git config --global user.name denv-docs-bot | ||
git config --global user.email [email protected] | ||
git switch -c auto-man-update | ||
git add man | ||
git commit -m "Auto Man Page Update" || exit 0 | ||
git push | ||
git commit -m "Auto Man Page Update from ${{ github.event.head_commit.message }}" || exit 0 | ||
git push -fu origin auto-man-update | ||
gh pr create --base main --head auto-man-update --title "Auto Man Page Update" --body "triggered by ${{ github.sha }}" | ||
env: | ||
GH_TOKEN: ${{ github.token }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
#!/bin/sh | ||
|
||
set -o nounset | ||
set -o errexit | ||
|
||
# update the version in the source files | ||
# ARGS | ||
# 1 - new version X.Y.Z | ||
update() { | ||
# manual source markdown | ||
sed -i "s|denv v.*$|denv v${1}|" docs/src/manual.md | ||
# install script | ||
sed -i "s|^version=v.*$|version=v${1}|" install | ||
# denv itself | ||
sed -i "s|^denv_version=.*$|denv_version=${1}|" denv | ||
} | ||
|
||
# check if passed version string is a valid version | ||
# ARGS | ||
# 1 - version string to test | ||
validate_version() { | ||
expr "${1}" : '^[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$' > /dev/null | ||
} | ||
|
||
# check if there are any changes the user hasn't commited yet | ||
check_changes() { | ||
# checks for any untracked or modified files | ||
git ls-files --other --modified --directory --exclude-standard | sed q1 > /dev/null | ||
} | ||
|
||
error() { | ||
printf >&2 "\033[1;31mERROR: \033[0m\033[31m%s\033[0m\n" "$*" | ||
} | ||
|
||
inf() { | ||
printf "\033[1mINFO: \033[0m%s\n" "$*" | ||
} | ||
|
||
help() { | ||
cat<<\HELP | ||
update the version of denv across all places | ||
USAGE: | ||
./ci/set-version [options] X.Y.Z | ||
ARGUMENTS | ||
X.Y.Z : new version string to use | ||
OPTIONS | ||
-h, --help : print this help and exit | ||
--commit : make a commit, tag, and push | ||
--dry-run : just show what would be done in | ||
a git-diff-like format | ||
--force : ignore if there are untracked | ||
or modified files in your git working tree | ||
HELP | ||
} | ||
|
||
if [ "$#" -eq 0 ]; then | ||
help | ||
exit 0 | ||
fi | ||
|
||
version="" | ||
commit=0 | ||
dry_run=0 | ||
force=0 | ||
while [ "$#" -gt 0 ]; do | ||
case "$1" in | ||
-h|--help) | ||
help | ||
exit 0 | ||
;; | ||
--commit) | ||
commit=1 | ||
;; | ||
--dry-run) | ||
dry_run=1 | ||
;; | ||
--force) | ||
force=1 | ||
;; | ||
-*) | ||
error "Unrecognized option '$1'" | ||
exit 1 | ||
;; | ||
*) | ||
if [ -z "${version}" ]; then | ||
version="$1" | ||
else | ||
error "./ci/set-version only accepts a single argument" | ||
exit 1 | ||
fi | ||
;; | ||
esac | ||
shift | ||
done | ||
|
||
if [ -z "${version}" ]; then | ||
error "need to define the version we should use" | ||
exit 1 | ||
fi | ||
|
||
if ! validate_version "${version}"; then | ||
error "version string '${version}' does not match X.Y.Z" | ||
exit 1 | ||
fi | ||
|
||
if ! check_changes && [ "${force}" -eq "0" ]; then | ||
error "Some untracked or modified files are still in the git area. Did you commit all the changes?" | ||
exit 1 | ||
fi | ||
|
||
update "${version}" | ||
|
||
# use git diff to print what we changed and then | ||
# show what other commands would be run given the command options | ||
if [ "${dry_run}" -eq "1" ]; then | ||
git diff docs/src/manual.md install denv | ||
if [ "${commit}" -eq "1" ]; then | ||
echo git add docs/src/manual.md install denv | ||
echo git commit -m "set version to v${1}" | ||
echo git tag "v${1}" | ||
echo git push --tags | ||
fi | ||
# undo the changes we made | ||
git restore docs/src/manual.md install denv | ||
exit 0 | ||
fi | ||
|
||
# down here if not in a dry, run keep the applied changes | ||
if [ "${commit}" -eq "1" ]; then | ||
git add docs/src/manual.md install denv | ||
git commit -m "set version to v${1}" | ||
git tag "v${1}" | ||
git push --tags | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,7 +63,7 @@ Options: | |
EOF | ||
} | ||
|
||
version=v0.2.0 | ||
version=v0.2.1 | ||
next=0 | ||
verbose=0 | ||
devel=0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters