Skip to content

Commit

Permalink
feature: add build and release action
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian authored and Christian committed Jan 6, 2025
1 parent 4f6eefd commit 13b59e2
Show file tree
Hide file tree
Showing 2 changed files with 135 additions and 0 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle

name: Run build and tests

on:
push:
branches:
- '*'
pull_request:
branches: [ master ]

jobs:
build:
environment: CIRelease
runs-on: ubuntu-latest

steps:
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 8
- uses: actions/checkout@v3
with:
fetch-depth: 0
- run: git fetch --all --tags

- name: Create .gradle dir
run: mkdir -p $HOME/.gradle
- name: Install gpg secret key
env:
SIGNINGFILE: ${{ secrets.SIGNINGFILE }}
run: |
cat <(echo -e "${{ secrets.SIGNINGFILE }}") | gpg --batch --import
gpg --list-secret-keys --keyid-format LONG
- name: Export gpg file
env:
SIGNINGKEYID: ${{ secrets.SIGNINGKEYID }}
SIGNINGPASSWORD: ${{ secrets.SIGNINGPASSWORD }}
run: |
gpg --batch --passphrase="$SIGNINGPASSWORD" --pinentry-mode loopback --export-secret-keys $SIGNINGKEYID > $HOME/.gradle/secrets.gpg
- name: Create gradle sproperties
env:
APIKEY: ${{ secrets.APIKEY }}
APISECRET: ${{ secrets.APISECRET }}
SIGNINGKEYID: ${{ secrets.SIGNINGKEYID }}
SIGNINGPASSWORD: ${{ secrets.SIGNINGPASSWORD }}
SONATYPEPASSWORD: ${{ secrets.SONATYPEPASSWORD }}
SONATYPEUSER: ${{ secrets.SONATYPEUSER }}
SVNURL: ${{ secrets.SVNURL }}
SVNUSER: ${{ secrets.SVNUSER }}
SVNPASSWD: ${{ secrets.SVNPASSWD }}
GITURL: ${{ secrets.GITURL }}
GITUSER: ${{ secrets.GITUSER }}
GITPASSWD: ${{ secrets.GITPASSWD }}
run: |
echo -e "systemProp.GITURL=$GITURL\nsystemProp.GITUSER=$GITUSER\nsystemProp.GITPASSWD=$GITPASSWD\nsystemProp.SVNURL=$SVNURL\nsystemProp.SVNUSER=$SVNUSER\nsystemProp.SVNPASSWD=$SVNPASSWD" > $HOME/.gradle/gradle.properties
echo -e "gradle.publish.key=$APIKEY\ngradle.publish.secret=$APISECRET\nsigning.keyId=$SIGNINGKEYID\nsigning.password=$SIGNINGPASSWORD\nsigning.secretKeyRingFile=$HOME/.gradle/secrets.gpg\nsonatypeUsername=$SONATYPEUSER\nsonatypePassword=$SONATYPEPASSWORD" >> $HOME/.gradle/gradle.properties
- name: Build and test with Gradle
env:
ISHUSERNAME: ${{ secrets.ISHUSERNAME }}
ISHKEY: ${{ secrets.ISHKEY }}
JAVA_OPTS: "-Xmx1024M -XX:ReservedCodeCacheSize=512M"
GRADLE_OPTS: "-Dorg.gradle.daemon=true"
run: ./gradlew test build :publishIntershopMvnPublicationToMavenRepository -s
- name: Post Build
run: rm -f $HOME/.gradle/gradle.properties && rm -f $HOME/.docker/config.json
67 changes: 67 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle

name: Run release build from tag

on:
push:
tags:
- '*'

jobs:
release:
environment: CIRelease
runs-on: ubuntu-latest

steps:
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 8
- uses: actions/checkout@v3
with:
fetch-depth: 0
- run: git fetch --all --tag
- name: Create .gradle dir
run: mkdir -p $HOME/.gradle
- id: install-secret-key
name: Install gpg secret key
env:
SIGNINGFILE: ${{ secrets.SIGNINGFILE }}
run: |
cat <(echo -e "${{ secrets.SIGNINGFILE }}") | gpg --batch --import
gpg --list-secret-keys --keyid-format LONG
- id: export-gpg-file
name: Export gpg file
env:
SIGNINGKEYID: ${{ secrets.SIGNINGKEYID }}
SIGNINGPASSWORD: ${{ secrets.SIGNINGPASSWORD }}
run: |
gpg --batch --passphrase="$SIGNINGPASSWORD" --pinentry-mode loopback --export-secret-keys $SIGNINGKEYID > $HOME/.gradle/secrets.gpg
- name: Create gradle sproperties
env:
APIKEY: ${{ secrets.APIKEY }}
APISECRET: ${{ secrets.APISECRET }}
SIGNINGKEYID: ${{ secrets.SIGNINGKEYID }}
SIGNINGPASSWORD: ${{ secrets.SIGNINGPASSWORD }}
SONATYPEPASSWORD: ${{ secrets.SONATYPEPASSWORD }}
SONATYPEUSER: ${{ secrets.SONATYPEUSER }}
SVNURL: ${{ secrets.SVNURL }}
SVNUSER: ${{ secrets.SVNUSER }}
SVNPASSWD: ${{ secrets.SVNPASSWD }}
GITURL: ${{ secrets.GITURL }}
GITUSER: ${{ secrets.GITUSER }}
GITPASSWD: ${{ secrets.GITPASSWD }}
run: |
echo -e "systemProp.GITURL=$GITURL\nsystemProp.GITUSER=$GITUSER\nsystemProp.GITPASSWD=$GITPASSWD\nsystemProp.SVNURL=$SVNURL\nsystemProp.SVNUSER=$SVNUSER\nsystemProp.SVNPASSWD=$SVNPASSWD" > $HOME/.gradle/gradle.properties
echo -e "gradle.publish.key=$APIKEY\ngradle.publish.secret=$APISECRET\nsigning.keyId=$SIGNINGKEYID\nsigning.password=$SIGNINGPASSWORD\nsigning.secretKeyRingFile=$HOME/.gradle/secrets.gpg\nsonatypeUsername=$SONATYPEUSER\nsonatypePassword=$SONATYPEPASSWORD" >> $HOME/.gradle/gradle.properties
- name: Run gradle release
env:
ISHUSERNAME: ${{ secrets.ISHUSERNAME }}
ISHKEY: ${{ secrets.ISHKEY }}
JAVA_OPTS: "-Xmx1024M -XX:ReservedCodeCacheSize=512M"
GRADLE_OPTS: "-Dorg.gradle.daemon=true"
run: ./gradlew -PrunOnCI=true test build :publishIntershopMvnPublicationToMavenRepository :publishPlugins -s
- name: Post Build
run: rm -f $HOME/.gradle/gradle.properties

0 comments on commit 13b59e2

Please sign in to comment.