Skip to content

Release

Release #11

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
versionIncrement:
required: true
description: major, minor or patch
type: choice
default: patch
options:
- major
- minor
- patch
jobs:
publish:
name: Publish artifact
runs-on: ubuntu-latest
steps:
- if: github.ref != 'refs/heads/main'
run: |
echo "This workflow should not be triggered on a branch other than main"
exit 1
- uses: actions/checkout@v3
- uses: actions/setup-java@v1
with:
java-version: ${{ vars.JAVA_VERSION }}
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Get next tag and version
id: tag_version
uses: mathieudutour/github-tag-action@v6.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
default_bump: ${{ github.event.inputs.versionIncrement }}
create_annotated_tag: true
dry_run: true
- name: Generate gradle.properties file
run: |
echo "publishVersion=${{ steps.tag_version.outputs.new_version }}" >> gradle.properties
echo "sonatypeUsername=${{ secrets.SONATYPE_USERNAME }}" >> gradle.properties
echo "sonatypePassword=${{ secrets.SONATYPE_PASSWORD }}" >> gradle.properties
echo "githubToken=${{ secrets.GITHUB_TOKEN }}" >> gradle.properties
echo "signing.keyId=${{ secrets.PUBLISH_SIGNING_KEY_ID }}" >> gradle.properties
echo "signing.password=${{ secrets.SONATYPE_PASSWORD }}" >> gradle.properties
echo "signing.key=${{ secrets.PUBLISH_SIGNING_KEY }}" >> gradle.properties
- name: Build
run: ./gradlew clean test build ${{ vars.GRADLE_FLAGS }}
- name: Publish to Sonatype
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository ${{ vars.GRADLE_FLAGS }}
- name: Publish to GitHub packages
run: ./gradlew publishAllPublicationsToGithubRepository ${{ vars.GRADLE_FLAGS }}
- name: Bump version and push tag
uses: mathieudutour/github-tag-action@v6.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
default_bump: ${{ github.event.inputs.versionIncrement }}
created_annotated_tag: true
- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: Release ${{ steps.tag_version.outputs.new_tag }}
generateReleaseNotes: true
update:
name: Update documentation
needs: publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v1
with:
java-version: ${{ vars.JAVA_VERSION }}
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Generate API documentation
run: ./gradlew dokkaHtml
- name: Deploy API documentation to Github Pages
uses: JamesIves/github-pages-deploy-action@4.1.5
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: build/dokka/html