Repository navigation
chore: prepare Modrinth release publishing #45
Workflow file for this run
This file contains hidden or 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: Release and Publish API | |
| on: | |
| push: | |
| branches: | |
| - feat/platform | |
| workflow_dispatch: | |
| jobs: | |
| build-and-publish-api: | |
| runs-on: blacksmith-4vcpu-ubuntu-2404 | |
| outputs: | |
| gradle_version: ${{ steps.versions.outputs.gradle_version }} | |
| commit_hash: ${{ steps.versions.outputs.commit_hash }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v7 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '21' | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v6 | |
| with: | |
| cache-read-only: false | |
| - name: Make gradlew executable | |
| run: chmod +x ./gradlew | |
| - name: Get Versions | |
| id: versions | |
| run: | | |
| BASE_VERSION=$(sed -nE 's/^val baseVersion = "([^"]+)"/\1/p' build.gradle.kts) | |
| if [ -z "$BASE_VERSION" ]; then | |
| echo "Unable to read baseVersion from build.gradle.kts" >&2 | |
| exit 1 | |
| fi | |
| echo "gradle_version=$BASE_VERSION" >> "$GITHUB_OUTPUT" | |
| echo "commit_hash=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" | |
| - name: Test and Publish API | |
| run: | | |
| ./gradlew :api:prepareGeneratedSources :api:check :api:publishMavenPublicationToSimplecloudRepository \ | |
| --parallel \ | |
| --build-cache \ | |
| --configuration-cache | |
| env: | |
| COMMIT_HASH: ${{ steps.versions.outputs.commit_hash }} | |
| SIMPLECLOUD_USERNAME: ${{ secrets.SIMPLECLOUD_USERNAME }} | |
| SIMPLECLOUD_PASSWORD: ${{ secrets.SIMPLECLOUD_PASSWORD }} | |
| - name: Summary | |
| run: | | |
| echo "## API Build Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Branch:** ${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Version:** ${{ steps.versions.outputs.gradle_version }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Commit:** ${{ steps.versions.outputs.commit_hash }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Published:** API module only to SimpleCloud Maven repository" >> $GITHUB_STEP_SUMMARY |