Skip to content

Publish

Publish #7

Workflow file for this run

name: Publish
on:
workflow_dispatch:
release:
types: [ prereleased, released ]
permissions:
contents: write
jobs:
release:
name: Publish library
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name }}
- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
- name: setup-java
uses: actions/setup-java@v4
with:
java-version: 17
distribution: adopt
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Gradle Wrapper Validation
uses: gradle/actions/wrapper-validation@v4
- name: Deploy to Sonatype
run: |
NEW_VERSION=$(echo "${GITHUB_REF}" | cut -d "/" -f3)
echo "New version: ${NEW_VERSION}"
export ORG_GRADLE_PROJECT_VERSION_NAME=${NEW_VERSION}
echo "RELEASE_VERSION=$NEW_VERSION" >> "$GITHUB_ENV"
./gradlew publishAllPublicationsToMavenCentral --no-configuration-cache --stacktrace
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.OSSRH_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.OSSRH_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
- name: Update README for ${{ env.RELEASE_VERSION }}
run: ./.github/version.sh "${RELEASE_VERSION}"
- name: Commit changes to README
uses: EndBug/add-and-commit@v9
with:
add: "./README.md"
message: "Update README.md with version ${{ env.RELEASE_VERSION }}"
new_branch: main
documentation:
name: "Generate Documentation"
runs-on: ubuntu-latest
needs: release
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: 17
distribution: adopt
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Gradle Wrapper Validation
uses: gradle/actions/wrapper-validation@v4
- name: Generate documentation
run: ./gradlew dokkaHtmlMultiModule --no-configuration-cache
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: dokka/