Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GitHub release action #17

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: release

on:
push:
branches: [ main ]
tags: 'ipresource-*'

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Prepare environment
run: |
sudo apt-get install rsync git gnupg

- name: Checkout Code
uses: actions/[email protected]

- name: Setup Java
uses: actions/[email protected]
with:
java-version: 8

- name: Release
env:
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
GPG_KEY: ${{ secrets.GPG_KEY }}
SONATYPE_NEXUS_SNAPSHOTS_USERNAME: ${{ secrets.SONATYPE_NEXUS_SNAPSHOTS_USERNAME }}
SONATYPE_NEXUS_SNAPSHOTS_PASSWORD: ${{ secrets.SONATYPE_NEXUS_SNAPSHOTS_PASSWORD }}
SONATYPE_NEXUS_STAGING_USERNAME: ${{ secrets.SONATYPE_NEXUS_STAGING_USERNAME }}
SONATYPE_NEXUS_STAGING_PASSWORD: ${{ secrets.SONATYPE_NEXUS_STAGING_PASSWORD }}
run: |
# checking GPG signing support
if [ -n "$GPG_KEY" ]; then
echo "$GPG_KEY" | gpg --batch --no-tty --allow-secret-key-import --import -
unset GPG_KEY
export GPG_KEYID=$(gpg --with-colon --list-secret-keys | head -n1 | cut -d : -f 5)

# GPG stuff works, do the release
export MAVEN_OPTS="-Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=$HOME/.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true"

VERSION=$(echo ${GITHUB_REF#refs/*/} | sed -e 's/ipresource-//')
echo "Will be releasing ${VERSION}"

mvn versions:set -DnewVersion=${VERSION}
mvn $MAVEN_CLI_OPTS deploy -s ci_settings.xml -P default,release
echo "done"
else
echo -e "\033[0;31m****** GPG signing disabled ******\033[0m"
fi

3 changes: 3 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,9 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<pushChanges>false</pushChanges>
</configuration>
</plugin>
</plugins>
</pluginManagement>
Expand Down