From 5c119f976691b612f6a805671ed682821a77a9ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Berg=20Glasius?= Date: Fri, 29 Dec 2023 17:41:17 +0100 Subject: [PATCH] Removed travis added gh-actions --- .github/workflows/github-pages.yml | 52 +++++++++++++++++++++++++ .github/workflows/gradle-check.yml | 23 +++++++++++ .github/workflows/release.yml | 61 ++++++++++++++++++++++++++++++ travis-build.sh | 48 ----------------------- 4 files changed, 136 insertions(+), 48 deletions(-) create mode 100644 .github/workflows/github-pages.yml create mode 100644 .github/workflows/gradle-check.yml create mode 100644 .github/workflows/release.yml delete mode 100755 travis-build.sh diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml new file mode 100644 index 00000000..c0551b78 --- /dev/null +++ b/.github/workflows/github-pages.yml @@ -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/get-version-action@v3.0.0 + 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 + diff --git a/.github/workflows/gradle-check.yml b/.github/workflows/gradle-check.yml new file mode 100644 index 00000000..d188ed7b --- /dev/null +++ b/.github/workflows/gradle-check.yml @@ -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 + - name: Build with Gradle + run: ./gradlew check diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..542397e2 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,61 @@ +name: Release +on: + release: + types: [ published ] +jobs: + release: + runs-on: ubuntu-latest + env: + GIT_USER_NAME: sbglasius + GIT_USER_EMAIL: soeren@glasius.dk + steps: + - uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/setup-java@v4 + with: + java-version: 8 + distribution: temurin + - uses: dhkatz/get-version-action@v3.0.0 + id: get_version + - uses: micronaut-projects/github-actions/pre-release@master + with: + token: ${{ secrets.GITHUB_TOKEN }} + - name: Publish to Sonatype OSSRH + id: publish + uses: gradle/gradle-build-action@v2 + env: + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} + SIGN_ARMORED_KEY: ${{ secrets.SIGN_ARMORED_KEY }} + SIGN_PASSWORD: ${{ secrets.SIGNING_PASSPHRASE }} + RELEASE_VERSION: ${{ steps.get_version.outputs.version-without-v }} + with: + arguments: -Pversion=${RELEASE_VERSION} publishToSonatype closeAndReleaseSonatypeStagingRepository + - name: Bump patch version by one + uses: flatherskevin/semver-action@v1 + id: version + with: + incrementLevel: patch + source: tags + - name: Set version in gradle.properties + env: + 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 project version to next SNAPSHOT' + - name: Export Gradle Properties + uses: micronaut-projects/github-actions/export-gradle-properties@master + - name: Run post-release + if: success() + uses: micronaut-projects/github-actions/post-release@master + with: + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/travis-build.sh b/travis-build.sh deleted file mode 100755 index 3302b01b..00000000 --- a/travis-build.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -set -e -chmod +x ./travis/*.sh - -EXIT_STATUS=0 - -echo "Test for branch $TRAVIS_BRANCH JDK: $TRAVIS_JDK_VERSION" - -./gradlew test --no-daemon || EXIT_STATUS=$? - -if [ $EXIT_STATUS -ne 0 ]; then - echo "test failed => exit $EXIT_STATUS" - exit $EXIT_STATUS -fi - -echo "Assemble for branch $TRAVIS_BRANCH JDK: $TRAVIS_JDK_VERSION" - -./gradlew assemble --no-daemon || EXIT_STATUS=$? - -if [ $EXIT_STATUS -ne 0 ]; then - echo "assemble failed => exit $EXIT_STATUS" - exit $EXIT_STATUS -fi - -if [ "${TRAVIS_JDK_VERSION}" == "openjdk11" ] ; then - echo "JDK 11 => exit $EXIT_STATUS" - exit $EXIT_STATUS -fi - -filename=$(find build/libs -name "*.jar" | head -1) -filename=$(basename "$filename") - -echo "Publishing archives for branch $TRAVIS_BRANCH JDK: $TRAVIS_JDK_VERSION" -if [[ -n $TRAVIS_TAG ]] || [[ $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST == 'false' ]]; then - - echo "Publishing archives" - - if [[ -n $TRAVIS_TAG ]]; then - ./gradlew bintrayUpload --no-daemon || EXIT_STATUS=$? - else - ./gradlew publish --no-daemon || EXIT_STATUS=$? - fi - - ./gradlew docs || EXIT_STATUS=$? - ./travis/publish_docs.sh -fi - -exit $EXIT_STATUS \ No newline at end of file