Publish #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish | |
on: | |
workflow_dispatch: | |
inputs: | |
deploy_api_reference: | |
description: 'Deploy API Reference?' | |
required: true | |
default: true | |
type: boolean | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
env: | |
RELEASE_PAGES_BRANCH: main | |
steps: | |
- name: Check branch | |
if: ${{ !contains(github.ref, 'refs/heads/release/') }} | |
run: | | |
echo "This action runs only on branches that start with 'release/'" | |
exit 1 | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Create Release Tag | |
run: | | |
export VERSION=$(cat gradle.properties | grep "version" | awk -F '=' '{print $2}') && \ | |
gh config set prompt disabled && \ | |
gh release create \ | |
--target "$GITHUB_REF_NAME" \ | |
--title "$VERSION" \ | |
--generate-notes \ | |
$VERSION | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Publish to Maven Central | |
run: ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache | |
env: | |
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }} | |
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} | |
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_KEY }} | |
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_KEY_PASSWORD }} | |
- name: Build API Reference | |
if: ${{ github.event.inputs.deploy_api_reference == 'true' }} | |
run: ./gradlew dokkaHtmlMultiModule | |
- name: Deploy API Reference to Cloudflare Pages | |
if: ${{ github.event.inputs.deploy_api_reference == 'true' }} | |
uses: cloudflare/wrangler-action@v3 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_PAGES_DEPLOY_API_TOKEN }} | |
command: pages deploy build/dokka/htmlMultiModule --project-name=soil-api-reference --branch ${{ env.RELEASE_PAGES_BRANCH }} |