Skip to content
Snippets Groups Projects
Commit 8a695dc2 authored by Julien Girard-Satabin's avatar Julien Girard-Satabin Committed by Michele Alberti
Browse files

[wip] A bit cleaner version update script

parent 0ba93061
No related branches found
No related tags found
No related merge requests found
variables: variables:
CAISAR_VERSION: "2.0.0" CAISAR_VERSION: "2.0"
TAG: "2.0.0" TAG: "2.0.0"
default: default:
......
...@@ -36,21 +36,19 @@ view-doc: doc ...@@ -36,21 +36,19 @@ view-doc: doc
################################### ###################################
PROJECT_ID=1082 PROJECT_ID=1082
TAG=$(shell dune-release tag -f --yes > /dev/null 2>&1 && git describe --tags --abbrev=0)
PKG="caisar-$(TAG).tbz" PKG="caisar-$(TAG).tbz"
REG_VERSION=$(cat VERSION) REG_VERSION=$(cat VERSION)
PACKAGE_URL="https://git.frama-c.com/api/v4/projects/$(PROJECT_ID)/packages/generic/caisar/$(TAG)/$(PKG)" PACKAGE_URL="https://git.frama-c.com/api/v4/projects/$(PROJECT_ID)/packages/generic/caisar/$(TAG)/$(PKG)"
DESCRIPTION="$(shell sed -n -e "p;n;:next;/^##/Q;p;n;b next" CHANGES.md | perl -pe 's/\n/\\n/')" DESCRIPTION="$(shell sed -n -e "p;n;:next;/^##/Q;p;n;b next" CHANGES.md | perl -pe 's/\n/\\n/')"
release: release:
@echo "Are git tag $(TAG) and VERSION file $(REG_VERSION) the same? (y/n)?" @echo "Read $(REG_VERSION) from VERSION file. Proceed to release CAISAR with this version? (y/n)?"
@read yesno; test "$$yesno" = y @read yesno; test "$$yesno" = y
./update_version.sh ./update_version.sh
@echo -n $(DESCRIPTION) @echo -n $(DESCRIPTION)
@echo "Is the CHANGES.md correct for $(TAG) (y/n)?" @echo "Is the CHANGES.md correct for $(TAG) (y/n)?"
@read yesno; test "$$yesno" = y @read yesno; test "$$yesno" = y
@echo $(TAG) > VERSION dune-release tag $(REG_VERSION)
dune-release tag $(TAG)
dune-release distrib --skip-build --skip-lint dune-release distrib --skip-build --skip-lint
curl --header "PRIVATE-TOKEN: $(GITLAB_TOKEN)" \ curl --header "PRIVATE-TOKEN: $(GITLAB_TOKEN)" \
--upload-file _build/$(PKG) \ --upload-file _build/$(PKG) \
......
...@@ -29,7 +29,7 @@ author = 'The CAISAR Development Team' ...@@ -29,7 +29,7 @@ author = 'The CAISAR Development Team'
# built documents. # built documents.
# #
# The short X.Y version. # The short X.Y version.
version = '2.0.0' version = '2.0'
# The full version, including alpha/beta/rc tags. # The full version, including alpha/beta/rc tags.
release = '2.0.0' release = '2.0.0'
......
#!/usr/bin/env bash #!/usr/bin/env bash
# set -xe
set -xe if ! test -f VERSION; then
echo "This script must be run from CAISAR root directory."
exit 2
fi
# Update headers in source files to match current year # Update headers in source files to match current year
NEW_DATE=$(date "+%Y") NEW_DATE=$(date "+%Y")
OLD_DATE=$(date -d '1 year ago' "+%Y") OLD_DATE=$(date -d '1 year ago' "+%Y")
find . \( -type d -name .git -prune \) \( -type d -name ._build -prune \) -o -type f -print0 | xargs -0 sed -i 's/(C) '${OLD_DATE}'/(C) '${NEW_DATE}'/g' find . \( -type d -name .git -prune \) \( -type d -name ._build -prune \) -o -type f -print0 | xargs -0 sed -i 's/(C) '${OLD_DATE}'/(C) '${NEW_DATE}'/g'
# Update version in manual, ci and main.ml according to the VERSION file # Update version in manual, ci and dune-project according to the VERSION file
VERSION=$(cat VERSION) VERSION=$(cat VERSION)
sed -E -i 's/let version = "([0-9]\.)+[0-9]" in/let version = "2.0.0" in/g' src/main.ml MAJOR=$(echo "$VERSION" | awk -F '.' '{print $1}')
sed -E -i 's/version = \x27([0-9]\.)+[0-9]\x27/version = \x27'${VERSION}'\x27/g' doc/conf.py MINOR=$(echo "$VERSION" | awk -F '.' '{print $2}')
REV=$(echo "$VERSION" | awk -F '.' '{print $3}')
MAJOR_MINOR=${MAJOR}.${MINOR}
echo "Updating CAISAR version number to $VERSION".
sed -E -i 's/let version = "([0-9]\.)+[0-9]" in/let version = "'${VERSION}'" in/g' src/main.ml
echo "Changing version in CAISAR's manual."
sed -E -i 's/version = \x27([0-9]\.)+[0-9]\x27/version = \x27'${MAJOR_MINOR}'\x27/g' doc/conf.py
sed -E -i 's/release = \x27([0-9]\.)+[0-9]\x27/release = \x27'${VERSION}'\x27/g' doc/conf.py sed -E -i 's/release = \x27([0-9]\.)+[0-9]\x27/release = \x27'${VERSION}'\x27/g' doc/conf.py
sed -E -i 's/CAISAR_VERSION: "([0-9]\.)+[0-9]"/CAISAR_VERSION: "'${VERSION}'"/g' .gitlab-ci.yml echo "Changing version in CAISAR's CI."
sed -E -i 's/CAISAR_VERSION: "([0-9]\.)+[0-9]"/CAISAR_VERSION: "'${MAJOR_MINOR}'"/g' .gitlab-ci.yml
sed -E -i 's/TAG: "([0-9]\.)+[0-9]"/TAG: "'${VERSION}'"/g' .gitlab-ci.yml sed -E -i 's/TAG: "([0-9]\.)+[0-9]"/TAG: "'${VERSION}'"/g' .gitlab-ci.yml
echo "Changing version in dune-project."
sed -E -i 's/version ([0-9]\.)+[0-9]/version '${MAJOR_MINOR}'/g' dune-project
# Update version in tests # Update version in tests
echo "Changing version in dune tests."
sed -E -i 's/([0-9]\.)+[0-9]/'${VERSION}'/g' tests/help.t sed -E -i 's/([0-9]\.)+[0-9]/'${VERSION}'/g' tests/help.t
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment