Skip to content

Commit

Permalink
Fix for release
Browse files Browse the repository at this point in the history
  • Loading branch information
ebocher committed Jan 12, 2024
1 parent 9b227fe commit 59a0174
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 13 deletions.
67 changes: 54 additions & 13 deletions .github/workflows/CI release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: CI release
on:
workflow_dispatch:
inputs:
next-version:
nextVersion:
required: false
description: "Next version"
description: "Next version (optional)"

jobs:
build:
Expand All @@ -16,21 +16,20 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

# Setup the jdk using version 11 of adoptOpenJDK
- name: Java setup
# Setup the jdk using version 11 of Adoptium Temurin
- name: Setup java 11 using Adoptium Temurin
uses: actions/setup-java@v2
with:
distribution: adopt
java-version: 11
distribution: 'temurin'
java-version: '11'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE

# Set up the postgis database
- name: Postigs install
uses: SPalominos/[email protected]
# Setup postgis test DB
- uses: SPalominos/[email protected]
with:
psql_version: '9.6'
pgis_version: '2.5'
Expand Down Expand Up @@ -58,15 +57,57 @@ jobs:
# - upload release to maven repo
- name: Release
run: |
VERSION=${{ github.event.inputs.nextVersion }}
mvn \
--no-transfer-progress \
-ntp \
--batch-mode \
-P deploy \
-Dmaven.test.skip=true \
-P standalone,integration \
release:prepare release:perform \
-Dusername=$GITHUB_ACTOR -Dpassword=$GITHUB_TOKEN -DtagNameFormat=v@{project.version} \
${VERSION:+-DreleaseVersion VERSION}
-Dusername=$GITHUB_ACTOR -Dpassword=$GITHUB_TOKEN ${VERSION:+"-DdevelopmentVersion="$VERSION"-SNAPSHOT"}
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_PASSWORD }}
VERSION: $next-version

# Export the last git tag into env.
- name: Export env values
run: echo "GIT_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)" >> $GITHUB_ENV

# Make the github release from the last created tag. Write in its body the content of the changelog file.
- name: Make github release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ env.GIT_TAG }}
release_name: ${{ env.GIT_TAG }}
body_path: docs/CHANGELOG.md
draft: false
prerelease: false

# Clear the changelog file and add its header
- name: Clear changelog
run: |
echo "## Changelog for v$( mvn help:evaluate -Dexpression=project.version | sed -n -e '/^\[.*\]/ !{ /^[0-9]/ { p; q } }' | cut -d- -f1)" > docs/CHANGELOG.md
git commit -a -m "Empty changelog."
git push origin master
# If the version change is a major or minor, create a branch from the previous tag for future revisions.
- name: Branch fork
run: |
GIT_TAG="${GIT_TAG:1}"
CUR_TAG="$( mvn help:evaluate -Dexpression=project.version | sed -n -e '/^\[.*\]/ !{ /^[0-9]/ { p; q } }' | cut -d- -f1)"
SPLIT0=(${GIT_TAG//./ })
SPLIT1=(${CUR_TAG//./ })
if [ "${SPLIT0[0]}" = "${SPLIT1[0]}" ] && [ "${SPLIT0[1]}" = "${SPLIT1[1]}" ]; then
echo "Revision change"
else
echo "Minor or Major change"
BRANCH="${SPLIT0[0]}.${SPLIT0[1]}.X"
git checkout -b "$BRANCH" "v${GIT_TAG}"
mvn versions:set -DnewVersion="${SPLIT0[0]}.${SPLIT0[1]}.$((${SPLIT0[2]}+1))-SNAPSHOT"
git commit -a -m "Set next version."
git push -u origin "$BRANCH"
fi
2 changes: 2 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## Changelog for v1.0.0
+ To be complete

0 comments on commit 59a0174

Please sign in to comment.