Skip to content

Commit

Permalink
Add Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
nomisRev committed Apr 11, 2024
1 parent 539f5c0 commit 8584205
Show file tree
Hide file tree
Showing 4 changed files with 148 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: "Build"

on:
push:
paths-ignore:
- 'docs/**'
- '*.md'
branches:
- main

jobs:
check:
runs-on: ubuntu-latest
timeout-minutes: 30

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 21

- uses: gradle/gradle-build-action@v2
with:
arguments: build --scan --full-stacktrace

- name: Bundle the build report
if: failure()
run: find . -type d -name 'reports' | zip -@ -r build-reports.zip

- name: Upload the build report
if: failure()
uses: actions/upload-artifact@master
with:
name: error-report
path: build-reports.zip
25 changes: 25 additions & 0 deletions .github/workflows/githubpages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: githubpages

on:
release:
types: [published]

jobs:
githubpages:
runs-on: ubuntu-latest
timeout-minutes: 20

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: gradle/gradle-build-action@v2
with:
arguments: -Pversion=${{ github.event.release.tag_name }} dokkaHtml

- name: Deploy to gh-pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
37 changes: 37 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: "Pull Request"

on:
pull_request:
paths-ignore:
- 'docs/**'
- '*.md'

jobs:
check:
runs-on: ubuntu-latest
timeout-minutes: 30

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 21

- uses: gradle/gradle-build-action@v2
with:
arguments: build --scan --full-stacktrace

- name: Bundle the build report
if: failure()
run: find . -type d -name 'reports' | zip -@ -r build-reports.zip

- name: Upload the build report
if: failure()
uses: actions/upload-artifact@master
with:
name: error-report
path: build-reports.zip
47 changes: 47 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: "Publish library"

on:
workflow_dispatch:
branches: [main]
inputs:
version:
description: 'Version'
required: true
type: string

env:
ORG_GRADLE_PROJECT_mavenCentralUsername: '${{ secrets.SONATYPE_USER }}'
ORG_GRADLE_PROJECT_mavenCentralPassword: '${{ secrets.SONATYPE_PWD }}'
ORG_GRADLE_PROJECT_signingInMemoryKeyId: '${{ secrets.SIGNING_KEY_ID }}'
ORG_GRADLE_PROJECT_signingInMemoryKey: '${{ secrets.SIGNING_KEY }}'
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: '${{ secrets.SIGNING_KEY_PASSPHRASE }}'

jobs:
publish:
timeout-minutes: 30
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 11

- uses: gradle/gradle-build-action@v2
with:
arguments: assemble -Pversion=${{ inputs.version }}

- name: Upload reports
if: failure()
uses: actions/upload-artifact@v4
with:
name: 'reports-${{ matrix.os }}'
path: '**/build/reports/**'

- name: Publish final version
uses: gradle/gradle-build-action@v2
with:
arguments: -Pversion=${{ inputs.version }} publishAllPublicationsToMavenCentralRepository

0 comments on commit 8584205

Please sign in to comment.