Skip to content

Commit 6b9ba0e

Browse files
authored
Merge pull request #855 from citation-file-format/update-version-script
2 parents 79c6953 + 1821519 commit 6b9ba0e

File tree

2 files changed

+63
-6
lines changed

2 files changed

+63
-6
lines changed

.github/update-version.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/bin/bash
2+
3+
function usage {
4+
echo -e "Usage:\n\n\tbash $0 X.Y.Z\n
5+
cffconvert will be required. If the command exists, it will be used.
6+
Otherwise, if you have docker installed, set USE_DOCKER=\"yes\" to use the docker image.
7+
Alternatively, you can set CFFCONVERT to specify the binary path."
8+
}
9+
10+
if [ ! $# -eq 1 ]; then
11+
usage
12+
exit 1
13+
fi
14+
15+
VERSION=$1
16+
17+
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
18+
echo "ERROR: Wrong input format"
19+
usage
20+
exit 1
21+
fi
22+
23+
if [ -n "$CFFCONVERT" ]; then
24+
if ! command -v "$CFFCONVERT" &> /dev/null; then
25+
echo "ERROR: CFFCONVERT was set to '$CFFCONVERT' but command does not exist"
26+
usage
27+
exit 1
28+
fi
29+
fi
30+
31+
if [ -z "$CFFCONVERT" ]; then
32+
if command -v cffconvert &> /dev/null; then
33+
echo "cffconvert found"
34+
CFFCONVERT=cffconvert
35+
elif command -v docker &> /dev/null && [ "$USE_DOCKER" == "yes" ]; then
36+
CFFCONVERT="docker run --rm -v $PWD:/app citationcff/cffconvert"
37+
else
38+
echo "ERROR: cffconvert was not found, install it first, possibly using"
39+
echo -e "\n\tpython -m venv env\n\t. env/bin/activate\n\tpip install --upgrade pip setuptools cffconvert\n"
40+
usage
41+
exit 1
42+
fi
43+
fi
44+
45+
sed -i "s/^date-released: .*$/date-released: $(date --iso)/" CITATION.cff
46+
sed -i "s/^version: .*$/version: $VERSION/" CITATION.cff
47+
echo "CITATION.cff updated"
48+
$CFFCONVERT -f zenodo -o .zenodo.json
49+
echo ".zenodo.json updated"
50+
sed -i "s/^ \"version.*$/ \"version\": \"$VERSION\",/" package.json
51+
sed -i "s/^ \"version.*$/ \"version\": \"$VERSION\",/" package-lock.json
52+
echo "package.json and package-lock.json updated"
53+
sed -i "s/Version .*$/Version $VERSION/" src/components/LayoutLanding.vue
54+
sed -i "s/Version .*$/Version $VERSION/" src/components/Footer.vue
55+
echo "LayoutLanding.vue and Footer.vue updated"

README.dev.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,17 @@ This section describes how to make a release in 2 parts:
166166

167167
### (1/2) Preparation
168168

169-
1. Update the `version`, the `date-released`, and possibly other information in `CITATION.cff`.
170-
1. Generate an updated version of `.zenodo.json` if needed using `cffconvert`.
171-
1. Update the `version` field in `package.json` and `package-lock.json`.
172-
1. Update the version in the [landing page footer](src/components/LayoutLanding.vue).
173-
1. Update the version in the [app footer](src/components/Footer.vue).
169+
1. Create a new branch `release-x.y.z`.
170+
1. Run the `update-version` script running `bash .github/update-version.sh x.y.z` and check the result. It should
171+
1. Update the `version`, the `date-released`, and possibly other information in `CITATION.cff`;
172+
1. Generate an updated version of `.zenodo.json` if needed using `cffconvert`;
173+
1. Update the `version` field in `package.json` and `package-lock.json`;
174+
1. Update the version in the [landing page footer](src/components/LayoutLanding.vue); and
175+
1. Update the version in the [app footer](src/components/Footer.vue).
174176
1. Run `npm run lint` and make sure the linter does not complain.
175177
1. Run the unit tests with `npm run test:unit:ci`.
176178
1. Run the end-to-end tests with `npm run cypress:run`.
177-
1. Push any changes to GitHub, make a PR.
179+
1. Commit and push all changes to GitHub, make a PR.
178180
1. Inspect the Netlify preview website.
179181
1. Review the PR and merge to the default branch `main`.
180182

0 commit comments

Comments
 (0)