-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
260 additions
and
95 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
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,113 @@ | ||
# Create a Release | ||
name: "Release" | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: "optional: version to release" | ||
required: false | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
# This will be used by git in all further steps | ||
# We need a PERSONAL ACCESS TOKEN so pushes trigger other GitHub actions | ||
token: ${{ secrets.BOT_ACCESS_TOKEN }} | ||
|
||
- name: Calculate realise version | ||
run: | | ||
if [ -z "${{ github.event.inputs.version }}" ] | ||
then | ||
v=$(grep -oPm1 "(?<=<version>)[^<]+" "pom.xml" | sed 's/-SNAPSHOT//') | ||
echo ${{ github.repository }} | ||
else | ||
v=${{ github.event.inputs.version }} | ||
fi | ||
echo "realise version ${v}" | ||
# Set as Environment for all further steps | ||
echo "VERSION=${v}" >> $GITHUB_ENV | ||
- name: Create Release Branch | ||
run: | | ||
# Config git | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "bot" | ||
# create branch | ||
git checkout -b release/v${VERSION} | ||
# Update version | ||
mvn versions:set -DnewVersion=${VERSION} -DprocessAllModules=true | ||
#edit changelog | ||
replace="s/\[unreleased\]/\[${VERSION}\]/" | ||
sed -i ${replace} CHANGELOG.md | ||
replace="s/...HEAD/\...v${VERSION}/" | ||
sed -i ${replace} CHANGELOG.md | ||
# commit & push | ||
git add -A | ||
git commit -m "release ${VERSION}: updated version to ${VERSION}" | ||
git push -u origin release/v${VERSION} | ||
# wait for status of commit to change from pending | ||
- name: Wait for ci pipeline | ||
run: | | ||
STATUS="pending" | ||
# Get commit last commit of release branch | ||
COMMIT=$(git rev-parse HEAD) | ||
echo "Listen for commit $COMMIT" | ||
WAITED="0" | ||
# Time between calls | ||
SLEEP_TIME="60" | ||
while [ "$STATUS" == "pending" ] && [ "$WAITED" -le 1800 ] | ||
do | ||
sleep ${SLEEP_TIME} | ||
WAITED=$((WAITED+SLEEP_TIME)) | ||
STATUS=$(gh api /repos/${{ github.repository }}/commits/"${COMMIT}"/status -q .state) | ||
echo "status : $STATUS" | ||
echo "waited $WAITED s" | ||
done | ||
echo "status : $STATUS" | ||
if [ "$STATUS" != "success" ] | ||
then exit 1 | ||
fi | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.BOT_ACCESS_TOKEN }} | ||
|
||
- name: Merge into Main | ||
run: | | ||
git checkout main | ||
git pull | ||
git merge --no-ff release/v${VERSION} | ||
git tag -a -m "v${VERSION}" "v${VERSION}" | ||
git push --follow-tags | ||
- name: Create Release | ||
run: | | ||
gh release create "v${VERSION}" -t "v${VERSION}" -F CHANGELOG.md -R ${{ github.repository }} --target main | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.BOT_ACCESS_TOKEN }} | ||
|
||
- name: Merge into dev | ||
run: | | ||
# increment minor version and add SNAPSHOT | ||
ARRAY_VERSION=( ${VERSION//./ } ) | ||
git checkout release/v${VERSION} | ||
NEXT_VERSION=${ARRAY_VERSION[0]}.$((ARRAY_VERSION[1]+1)).0-SNAPSHOT | ||
echo "next version: $NEXT_VERSION" | ||
# update version | ||
mvn versions:set -DnewVersion=${NEXT_VERSION} -DprocessAllModules=true | ||
#edit changelog | ||
sed -i '5i ## [unreleased]\n ### Added \n ### Fixed \n' CHANGELOG.md | ||
replace="$ a \[unreleased\]: https:\/\/github.com\/ehrbase\/openEHR_SDK\/compare\/v$VERSION...HEAD" | ||
sed -i "${replace}" CHANGELOG.md | ||
git add -A | ||
git commit -m " updated version to ${NEXT_VERSION}" | ||
git checkout develop | ||
git pull | ||
git merge --no-ff release/v${VERSION} | ||
git push | ||
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,23 @@ | ||
# Adds the results of a workflow as a commit status | ||
name: "Set test status" | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["Build and push"] # runs after build and test workflow | ||
types: | ||
- completed | ||
|
||
jobs: | ||
set_status: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
statuses: write | ||
steps: | ||
- name: Create status | ||
run: | | ||
gh api repos/${{ github.repository }}/statuses/${{ github.event.workflow_run.head_commit.id }} \ | ||
-f "state"="${{ github.event.workflow_run.conclusion }}" \ | ||
-f "context"="${{ github.event.workflow_run.event }}.${{ github.event.workflow_run.id}}"\ | ||
-f "target_url"="${{ github.event.workflow_run.html_url }}" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# 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.0.0/), and this project adheres | ||
to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [1.2.0] | ||
### Fixed | ||
|
||
- Fix class not found [[#9](https://github.com/ehrbase/migration-tool/pull/9)] | ||
|
||
## [1.1.0] | ||
|
||
Initial publicly available version. | ||
|
||
[1.2.0]: https://github.com/ehrbase/migration-tool/compare/v1.1.0...v1.2.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
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
Oops, something went wrong.