Skip to content

Commit

Permalink
Deploy SNAPSHOTs via GitHub Actions.
Browse files Browse the repository at this point in the history
  • Loading branch information
vy committed Jul 31, 2021
1 parent 7204175 commit 8c554e4
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 3 deletions.
48 changes: 48 additions & 0 deletions .github/maven-settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2018-2021 Volkan Yazıcı
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permits and
limitations under the License.
-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
<servers>
<server>
<id>sonatype-nexus-snapshots</id>
<username>${env.NEXUS_USER}</username>
<password>${env.NEXUS_PASS}</password>
</server>
<server>
<id>sonatype-nexus-staging</id>
<username>${env.NEXUS_USER}</username>
<password>${env.NEXUS_PASS}</password>
</server>
<server>
<id>gpg.passphrase</id>
<passphrase>${env.GPG_PKEY_PASS}</passphrase>
</server>
</servers>
<profiles>
<profile>
<id>nexus</id>
<activation>
<activeByDefault/>
</activation>
<properties>
<gpg.keyname>${env.GPG_PKEY_ID}</gpg.keyname>
<gpg.passphrase>${env.GPG_PKEY_PASS}</gpg.passphrase>
</properties>
</profile>
</profiles>
</settings>
44 changes: 41 additions & 3 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ name: CI
on: [push]

jobs:

build:

runs-on: ${{ matrix.os }}
Expand All @@ -35,10 +36,9 @@ jobs:
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
restore-keys: ${{ runner.os }}-maven-

- name: Set up JDK 8
- name: Setup JDK 8
uses: actions/setup-java@v2.1.0
with:
distribution: 'adopt'
Expand All @@ -54,3 +54,41 @@ jobs:
# pwsh (the default shell on Windows) hijacks "exec" keyword
shell: bash
run: ./mvnw -V -B --no-transfer-progress -e "-DtrimStackTrace=false" exec:java -Dexec.classpathScope=test -Dexec.mainClass=com.vlkan.rfos.SchedulerShutdownTestApp

deploy-snapshot:

runs-on: ubuntu-latest
needs: build

steps:

- name: Checkout repository
uses: actions/checkout@v2

- name: Setup Maven caching
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-

- name: Setup JDK 8
uses: actions/setup-java@v2.1.0
with:
distribution: adopt
java-version: 8
java-package: jdk
architecture: x64

- name: Import GPG private key
run: echo -n "$GPG_PKEY" | base64 --decode | gpg -v --batch --import --yes --pinentry-mode error
env:
GPG_PKEY: ${{ secrets.GPG_PKEY }}

- name: Deploy
run: ./mvnw -DskipTests=true -DperformRelease=true --settings .github/maven-settings.xml verify gpg:sign install:install deploy:deploy
env:
GPG_PKEY_ID: ${{ secrets.GPG_PKEY_ID }}
GPG_PKEY_PASS: ${{ secrets.GPG_PKEY_PASS }}
NEXUS_USER: ${{ secrets.NEXUS_USER }}
NEXUS_PASS: ${{ secrets.NEXUS_PASS }}
3 changes: 3 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>${maven-gpg-plugin.version}</version>
<configuration>
<useAgent>false</useAgent>
</configuration>
<executions>
<execution>
<id>sign-artifacts</id>
Expand Down

0 comments on commit 8c554e4

Please sign in to comment.