-
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.
Add scripts for releasing and update pom to allow pushing to sonatype (…
…#12) ## Description This PR contains scripts and workflows that handles releasing to github and sonatype. ## Type of Change * New feature (non-breaking change which adds functionality) ## Checklist - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings --------- Signed-off-by: Jakub Stejskal <[email protected]>
- Loading branch information
Showing
7 changed files
with
241 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Script change version and run build | ||
# then adds changes and do a release commit | ||
# then creates tag with version specified by argument | ||
# user must then push tags using `git push --tags` and do a release in github | ||
|
||
TAG=$1 | ||
echo "Tagging version to ${TAG}" | ||
|
||
mvn versions:set -DnewVersion=${TAG} | ||
mvn clean install | ||
git add "." | ||
git diff --staged --quiet || git commit -m "Release ${TAG}" | ||
git tag -a ${TAG} -m "${TAG}" |
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,12 @@ | ||
#!/usr/bin/env bash | ||
|
||
export GPG_TTY=$(tty) | ||
|
||
echo $GPG_SIGNING_KEY | base64 -d > signing.gpg | ||
gpg --batch --import signing.gpg | ||
|
||
GPG_EXECUTABLE=gpg mvn -DskipTests -s ./.github/scripts/settings.xml -P central-sonatype clean deploy | ||
|
||
rm -rf signing.gpg | ||
gpg --delete-keys | ||
gpg --delete-secret-keys |
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,11 @@ | ||
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> | ||
<servers> | ||
<server> | ||
<id>central</id> | ||
<username>${env.NEXUS_USERNAME}</username> | ||
<password>${env.NEXUS_PASSWORD}</password> | ||
</server> | ||
</servers> | ||
</settings> |
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,40 @@ | ||
name: Publish-release | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
publish-release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
server-id: github | ||
settings-path: ${{ github.workspace }} | ||
|
||
- name: Cache m2 repo | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.m2/repository | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-maven- | ||
- name: Build | ||
run: mvn clean install | ||
|
||
- name: Publish to sonatype | ||
run: ./.github/scripts/push-to-nexus.sh | ||
env: | ||
BUILD_ENV: 'github-actions' | ||
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }} | ||
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} | ||
GPG_KEYNAME: ${{ secrets.GPG_KEYNAME }} | ||
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | ||
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} |
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,45 @@ | ||
name: Publish-snapshot | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
|
||
jobs: | ||
publish-snapshot: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
server-id: github | ||
settings-path: ${{ github.workspace }} | ||
|
||
- name: Setup Maven settings.xml | ||
uses: whelk-io/maven-settings-xml-action@v11 | ||
with: | ||
servers: | ||
'[ | ||
{ | ||
"id": "github", | ||
"username": "${env.GITHUB_USERNAME}", | ||
"password": "${env.GITHUB_TOKEN}" | ||
} | ||
]' | ||
|
||
- name: Cache m2 repo | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.m2/repository | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-maven- | ||
- name: Publish to GitHub Packages Apache Maven | ||
run: mvn deploy | ||
env: | ||
GITHUB_USERNAME: x-access-token | ||
GITHUB_TOKEN: ${{ secrets.TOKEN }} | ||
BUILD_ENV: 'github-actions' |
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,35 @@ | ||
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"> | ||
<id>zip</id> | ||
<includeBaseDirectory>true</includeBaseDirectory> | ||
|
||
<formats> | ||
<format>tar.gz</format> | ||
<format>zip</format> | ||
<format>dir</format> | ||
</formats> | ||
<fileSets> | ||
<fileSet> | ||
<directory>${project.basedir}</directory> | ||
<includes> | ||
<include>README*</include> | ||
</includes> | ||
<fileMode>0644</fileMode> | ||
</fileSet> | ||
<fileSet> | ||
<directory>${project.basedir}</directory> | ||
<includes> | ||
<include>LICENSE</include> | ||
</includes> | ||
<fileMode>0644</fileMode> | ||
</fileSet> | ||
</fileSets> | ||
<dependencySets> | ||
<dependencySet> | ||
<scope>runtime</scope> | ||
<outputDirectory>libs</outputDirectory> | ||
<fileMode>0644</fileMode> | ||
</dependencySet> | ||
</dependencySets> | ||
</assembly> |