Skip to content

Commit

Permalink
Add github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsonlee committed Apr 8, 2022
1 parent 24f3db6 commit 67de01e
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Run unit tests

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

repository_dispatch:
types: [test]

jobs:
run-unit-test:
runs-on: ubuntu-latest

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

- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '8'

- name: build
run: ./gradlew check -S --no-daemon
46 changes: 46 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Publish build to Sonatype

on:
push:
tags:
- '*'
repository_dispatch:
types: [publish]

jobs:
publish:
runs-on: ubuntu-latest
if: github.repository == 'johnsonlee/codegen'

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

- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'

- name: publish to sonatype
run: |
echo "Release version ${GITHUB_REF/refs\/tags\/v/} ..."
echo "Create GPG private key"
echo $GPG_KEY_ARMOR | base64 --decode > ${GITHUB_WORKSPACE}/secring.gpg
./gradlew clean initializeSonatypeStagingRepository publishToSonatype closeAndReleaseRepository -S --no-daemon \
-Pversion=${GITHUB_REF/refs\/tags\/v/} \
-POSSRH_USERNAME=${OSSRH_USERNAME} \
-POSSRH_PASSWORD=${OSSRH_PASSWORD} \
-POSSRH_PACKAGE_GROUP=${OSSRH_PACKAGE_GROUP} \
-Psigning.keyId=${GPG_KEY_ID} \
-Psigning.password=${GPG_PASSPHRASE} \
-Psigning.secretKeyRingFile=${GITHUB_WORKSPACE}/secring.gpg
env:
JAVA_OPTS: -Xmx8g -XX:MaxPermSize=1g -XX:MetaspaceSize=1g -Dfile.encoding=UTF-8
JVM_OPTS: -Xmx8g -XX:MaxPermSize=1g -XX:MetaspaceSize=1g -Dfile.encoding=UTF-8
GPG_KEY_ARMOR: ${{ secrets.GPG_KEY_ARMOR }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PACKAGE_GROUP: ${{ secrets.OSSRH_PACKAGE_GROUP }}

0 comments on commit 67de01e

Please sign in to comment.