|
| 1 | +name: Release and Publish API |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - feat/platform |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +jobs: |
| 10 | + build-and-publish-api: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + outputs: |
| 13 | + gradle_version: ${{ steps.versions.outputs.gradle_version }} |
| 14 | + commit_hash: ${{ steps.versions.outputs.commit_hash }} |
| 15 | + steps: |
| 16 | + - name: Checkout repository |
| 17 | + uses: actions/checkout@v4 |
| 18 | + |
| 19 | + - name: Set up JDK 21 |
| 20 | + uses: actions/setup-java@v4 |
| 21 | + with: |
| 22 | + distribution: 'temurin' |
| 23 | + java-version: '21' |
| 24 | + cache: 'gradle' |
| 25 | + |
| 26 | + - name: Setup Gradle |
| 27 | + uses: gradle/actions/setup-gradle@v3 |
| 28 | + with: |
| 29 | + cache-read-only: false |
| 30 | + |
| 31 | + - name: Make gradlew executable |
| 32 | + run: chmod +x ./gradlew |
| 33 | + |
| 34 | + - name: Get Versions |
| 35 | + id: versions |
| 36 | + run: | |
| 37 | + echo "gradle_version=$(./gradlew properties -q | grep "version:" | awk '{print $2}')" >> $GITHUB_OUTPUT |
| 38 | + echo "commit_hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT |
| 39 | +
|
| 40 | + - name: Build API Module |
| 41 | + run: | |
| 42 | + ./gradlew :api:clean :api:build \ |
| 43 | + --parallel \ |
| 44 | + --build-cache \ |
| 45 | + --no-configuration-cache |
| 46 | + env: |
| 47 | + COMMIT_HASH: ${{ steps.versions.outputs.commit_hash }} |
| 48 | + |
| 49 | + - name: Publish API to Maven |
| 50 | + run: | |
| 51 | + ./gradlew :api:publishMavenJavaPublicationToSimplecloudRepository \ |
| 52 | + --parallel \ |
| 53 | + --build-cache \ |
| 54 | + --no-configuration-cache |
| 55 | + env: |
| 56 | + COMMIT_HASH: ${{ steps.versions.outputs.commit_hash }} |
| 57 | + SIMPLECLOUD_USERNAME: ${{ secrets.SIMPLECLOUD_USERNAME }} |
| 58 | + SIMPLECLOUD_PASSWORD: ${{ secrets.SIMPLECLOUD_PASSWORD }} |
| 59 | + |
| 60 | + - name: Summary |
| 61 | + run: | |
| 62 | + echo "## API Build Summary" >> $GITHUB_STEP_SUMMARY |
| 63 | + echo "- **Branch:** ${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY |
| 64 | + echo "- **Version:** ${{ steps.versions.outputs.gradle_version }}" >> $GITHUB_STEP_SUMMARY |
| 65 | + echo "- **Commit:** ${{ steps.versions.outputs.commit_hash }}" >> $GITHUB_STEP_SUMMARY |
| 66 | + echo "- **Published:** API module only to SimpleCloud Maven repository" >> $GITHUB_STEP_SUMMARY |
0 commit comments