Skip to content

Commit

Permalink
Merge pull request #855 from citation-file-format/update-version-script
Browse files Browse the repository at this point in the history
  • Loading branch information
abelsiqueira committed Aug 8, 2023
2 parents 79c6953 + 1821519 commit 6b9ba0e
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 6 deletions.
55 changes: 55 additions & 0 deletions .github/update-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/bash

function usage {
echo -e "Usage:\n\n\tbash $0 X.Y.Z\n
cffconvert will be required. If the command exists, it will be used.
Otherwise, if you have docker installed, set USE_DOCKER=\"yes\" to use the docker image.
Alternatively, you can set CFFCONVERT to specify the binary path."
}

if [ ! $# -eq 1 ]; then
usage
exit 1
fi

VERSION=$1

if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "ERROR: Wrong input format"
usage
exit 1
fi

if [ -n "$CFFCONVERT" ]; then
if ! command -v "$CFFCONVERT" &> /dev/null; then
echo "ERROR: CFFCONVERT was set to '$CFFCONVERT' but command does not exist"
usage
exit 1
fi
fi

if [ -z "$CFFCONVERT" ]; then
if command -v cffconvert &> /dev/null; then
echo "cffconvert found"
CFFCONVERT=cffconvert
elif command -v docker &> /dev/null && [ "$USE_DOCKER" == "yes" ]; then
CFFCONVERT="docker run --rm -v $PWD:/app citationcff/cffconvert"
else
echo "ERROR: cffconvert was not found, install it first, possibly using"
echo -e "\n\tpython -m venv env\n\t. env/bin/activate\n\tpip install --upgrade pip setuptools cffconvert\n"
usage
exit 1
fi
fi

sed -i "s/^date-released: .*$/date-released: $(date --iso)/" CITATION.cff
sed -i "s/^version: .*$/version: $VERSION/" CITATION.cff
echo "CITATION.cff updated"
$CFFCONVERT -f zenodo -o .zenodo.json
echo ".zenodo.json updated"
sed -i "s/^ \"version.*$/ \"version\": \"$VERSION\",/" package.json
sed -i "s/^ \"version.*$/ \"version\": \"$VERSION\",/" package-lock.json
echo "package.json and package-lock.json updated"
sed -i "s/Version .*$/Version $VERSION/" src/components/LayoutLanding.vue
sed -i "s/Version .*$/Version $VERSION/" src/components/Footer.vue
echo "LayoutLanding.vue and Footer.vue updated"
14 changes: 8 additions & 6 deletions README.dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,17 @@ This section describes how to make a release in 2 parts:

### (1/2) Preparation

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

Expand Down

0 comments on commit 6b9ba0e

Please sign in to comment.