Skip to content

Commit

Permalink
Merge pull request #332 from sbglasius/feature/gh-actions
Browse files Browse the repository at this point in the history
Removed travis added gh-actions
  • Loading branch information
sbglasius authored Dec 30, 2023
2 parents 8ce11bd + d29fa9b commit fba8f25
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 94 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Deploy docs to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: [ master ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
- uses: dhkatz/[email protected]
id: get_version
- uses: gradle/gradle-build-action@v2
env:
RELEASE_VERSION: ${{ steps.get_version.outputs.version-without-v }}
with:
arguments: -Pversion=${RELEASE_VERSION} :docs:asciidoctor
- uses: actions/configure-pages@v4
- uses: actions/upload-pages-artifact@v3
with:
path: 'docs/build/docs'
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/deploy-pages@v4
id: deployment

23 changes: 23 additions & 0 deletions .github/workflows/gradle-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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 tests in project

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 8
- uses: gradle/gradle-build-action@v2
with:
arguments: check
47 changes: 0 additions & 47 deletions .github/workflows/gradle.yml

This file was deleted.

45 changes: 21 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,16 @@ jobs:
GIT_USER_NAME: ${{ secrets.GIT_USER_NAME }}
GIT_USER_EMAIL: ${{ secrets.GIT_USER_EMAIL }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
token: ${{ secrets.GH_TOKEN }}
- name: Set up JDK
uses: actions/setup-java@v1
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-java@v4
with:
java-version: 8
- name: Get latest release version number
distribution: temurin
- uses: dhkatz/[email protected]
id: get_version
uses: battila7/get-version-action@v2
- name: Run pre-release
uses: micronaut-projects/github-actions/pre-release@master
- uses: micronaut-projects/github-actions/pre-release@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to Sonatype OSSRH
Expand All @@ -31,33 +28,33 @@ jobs:
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_NEXUS_URL: ${{ secrets.SONATYPE_NEXUS_URL }}
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY }}
SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }}
SECRING_FILE: ${{ secrets.SECRING_FILE }}
SIGN_ARMORED_KEY: ${{ secrets.SIGN_ARMORED_KEY }}
SIGN_PASSWORD: ${{ secrets.SIGNING_PASSPHRASE }}
RELEASE_VERSION: ${{ steps.get_version.outputs.version-without-v }}
with:
arguments: -Psigning.secretKeyRingFile=${{ github.workspace }}/secring.gpg publishToSonatype closeAndReleaseSonatypeStagingRepository
arguments: -Pversion=${RELEASE_VERSION} publishToSonatype closeAndReleaseSonatypeStagingRepository
- name: Bump patch version by one
uses: actions-ecosystem/action-bump-semver@v1
id: bump_semver
uses: flatherskevin/semver-action@v1
id: version
with:
current_version: ${{steps.get_version.outputs.version-without-v }}
level: patch
incrementLevel: patch
source: tags
- name: Set version in gradle.properties
id: snapshotVersion
uses: gradle/gradle-build-action@v2
env:
NEXT_VERSION: ${{ steps.bump_semver.outputs.new_version }}
with:
arguments: -Pversion="${NEXT_VERSION}"
NEXT_VERSION: ${{ steps.version.outputs.nextVersion }}
run: |
echo "Preparing next snapshot"
./gradlew snapshotVersion -Pversion="${NEXT_VERSION}"
- name: Commit & Push changes
uses: actions-js/push@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
author_name: ${{ secrets.GIT_USER_NAME }}
author_email: $${ secrets.GIT_USER_EMAIL }}
message: 'Set version to next SNAPSHOT'
message: 'Set project version to next SNAPSHOT'
- name: Export Gradle Properties
uses: micronaut-projects/github-actions/export-gradle-properties@master
- name: Build documentation
id: asciidoctor
uses: gradle/gradle-build-action@v2
Expand Down
42 changes: 19 additions & 23 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -109,37 +109,33 @@ publishing {
}
}

ext."signing.keyId" = project.findProperty('signing.keyId') ?: System.getenv('SIGNING_KEY_ID')
ext."signing.password" = project.findProperty('signing.password') ?: System.getenv('SIGNING_PASSPHRASE')
ext."signing.secretKeyRingFile" = project.findProperty('signing.secretKeyRingFile') ?: (System.getenv('SIGNING_PASSPHRASE') ?: "${System.getProperty('user.home')}/.gnupg/secring.gpg")

ext.isReleaseVersion = !version.endsWith("SNAPSHOT")

afterEvaluate {
signing {
required { isReleaseVersion }
sign publishing.publications.maven
}
import io.github.gradlenexus.publishplugin.InitializeNexusStagingRepository

tasks.withType(InitializeNexusStagingRepository).configureEach {
onlyIf { isReleaseVersion }
shouldRunAfter(tasks.withType(Sign))
}

tasks.withType(Sign) {
onlyIf { isReleaseVersion }
}

nexusPublishing {
repositories {
sonatype {
def ossUser = System.getenv("SONATYPE_USERNAME") ?: project.findProperty('sonatypeOss2Username') ?: ''
def ossPass = System.getenv("SONATYPE_PASSWORD") ?: project.findProperty("sonatypeOss2Password") ?: ''
def ossStagingProfileId = System.getenv("SONATYPE_STAGING_PROFILE_ID") ?: project.findProperty("sonatypeOssStagingProfileIdJms") ?: ''

nexusUrl = uri("https://s01.oss.sonatype.org/service/local/")
snapshotRepositoryUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
username = ossUser
password = ossPass
stagingProfileId = ossStagingProfileId
}
}
repositories {
sonatype {
def ossUser = System.getenv("SONATYPE_USERNAME") ?: project.hasProperty("sonatypeOssUsername") ? project.sonatypeOssUsername : ''
def ossPass = System.getenv("SONATYPE_PASSWORD") ?: project.hasProperty("sonatypeOssPassword") ? project.sonatypeOssPassword : ''
def ossStagingProfileId = System.getenv("SONATYPE_STAGING_PROFILE_ID") ?: project.hasProperty("sonatypeOssStagingProfileIdExternalConfig") ? project.sonatypeOssStagingProfileIdExternalConfig : ''

nexusUrl = uri("https://oss.sonatype.org/service/local/")
snapshotRepositoryUrl = uri("https://oss.sonatype.org/content/repositories/snapshots/")
username = ossUser
password = ossPass
stagingProfileId = ossStagingProfileId
}
}
}

asciidoctor {
Expand Down Expand Up @@ -169,7 +165,7 @@ asciidoctor.dependsOn(apiDocs)

task snapshotVersion {
doLast {
if (!project.version.endsWith('-SNAPSHOT')) {
if (isReleaseVersion) {
ant.propertyfile(file: "gradle.properties") {
entry(key: "version", value: "${project.version}-SNAPSHOT")
}
Expand Down

0 comments on commit fba8f25

Please sign in to comment.