From 3cf6dbbddfcc819cd08d6ce6c7e8110b484963bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Guimar=C3=A3es?= Date: Fri, 29 Nov 2024 12:24:05 +0000 Subject: [PATCH] Update README.md; Add release scripts --- CHANGELOG.md | 6 ++++ DEV_NOTES.md | 24 +++++++++++++ README.md | 10 +++++- dev/scripts/prepare-next-version.sh | 29 ++++++++++++++++ dev/scripts/release.sh | 53 +++++++++++++++++++++++++++++ 5 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 CHANGELOG.md create mode 100644 DEV_NOTES.md create mode 100755 dev/scripts/prepare-next-version.sh create mode 100755 dev/scripts/release.sh diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..9e0e2bb --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,6 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). diff --git a/DEV_NOTES.md b/DEV_NOTES.md new file mode 100644 index 0000000..8d463bc --- /dev/null +++ b/DEV_NOTES.md @@ -0,0 +1,24 @@ +# DEV Notes + +## How to release a new version + +Before create a new version please update the CHANGELOG.md. + +```bash +bash dev/scripts/release.sh 1.0.0 +``` + +This will trigger a CI/CD pipeline where it will: + +* Build & packaging the JDK library and CLI +* Build & deploy a docker image +* Create a draft GitHub release + +After the pipeline ends please do the following step: + +* Update the draft GitHub release +* Run the prepare next version script + +```bash +bash dev/scripts/prepare-next-release.sh 1.1.0 +``` diff --git a/README.md b/README.md index f98fc68..9382393 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,14 @@ # commons-ip-cits-siard -Tool and Java Library to support creation and validation of E-ARK SIP following CITS SIARD specification +A Command line interface (CLI) and Java Library to support creation and validation of E-ARK SIP following CITS SIARD specification + +[![GitHub latest release](https://img.shields.io/github/v/release/keeps/commons-ip-cits-siard?sort=semver&color=informational)](https://github.com/keeps/commons-ip-cits-siard/releases/latest) +![GitHub downloads](https://img.shields.io/github/downloads/keeps/commons-ip-cits-siard/total) +[![GitHub contributors](https://img.shields.io/github/contributors/keeps/commons-ip-cits-siard)](https://github.com/keeps/commons-ip-cits-siard/graphs/contributors) +![GitHub commit activity (branch)](https://img.shields.io/github/commit-activity/m/keeps/commons-ip-cits-siard) + +[![testing](https://github.com/keeps/commons-ip-cits-siard/actions/workflows/CI.yml/badge.svg)](https://github.com/keeps/commons-ip-cits-siard/actions/workflows/CI.yml?label=testing) + > [!WARNING] > Currently being developed diff --git a/dev/scripts/prepare-next-version.sh b/dev/scripts/prepare-next-version.sh new file mode 100755 index 0000000..b5e3f61 --- /dev/null +++ b/dev/scripts/prepare-next-version.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) + +REGEX="([0-9]+).([0-9]+).([0-9]+)" + +if [[ $VERSION =~ $REGEX ]]; then + MAJOR="${BASH_REMATCH[1]}" + MINOR="${BASH_REMATCH[2]}" +fi + +MINOR=$((MINOR + 1)) +BUILD="0" + +SNAPSHOT_VERSION="${MAJOR}.${MINOR}.${BUILD}-SNAPSHOT" + +cat <" + echo "Example: $0 2.5.0" + exit 1 +else + regex="([0-9]+).([0-9]+).([0-9]+)" + if [[ $1 =~ $regex ]]; then + read -p "Did you update the CHANGELOG.md? (yes/no): " answer + case $answer in + [Yy]*) release "$1" ;; + [Nn]*) + echo "Update the CHANGELOG.md before release a new version" + exit 1 + ;; + *) echo "Please answer yes or no." ;; + esac + else + echo "Please provide a version that follows semantic versioning syntax" + exit 1 + fi +fi