test ci #49
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: Luminol CI | |
| on: | |
| push: | |
| branches: | |
| - "**" | |
| pull_request: | |
| branches: | |
| - "**" | |
| workflow_dispatch: | |
| inputs: | |
| force-release: | |
| description: "Force disable release if you enter 2, force release if you enter 1, default release if not released else skip release" | |
| required: false | |
| default: "" | |
| force-push: | |
| description: "Force disable push to repo if you enter 2, push to repo if you enter 1, default push if not released else skip push repo" | |
| required: false | |
| default: "" | |
| comments: | |
| description: "Add comments to release" | |
| required: false | |
| default: "" | |
| permissions: write-all | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| environment: default | |
| steps: | |
| - name: Checkout Git Repository | |
| uses: actions/checkout@v6 | |
| - name: Set Up JDK | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: zulu | |
| java-version: 21 | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v5 | |
| - name: Configure Git User Details | |
| run: git config --global user.email "[email protected]" && git config --global user.name "LuminolMC CI" | |
| - name: Apply All Patches | |
| run: ./gradlew --refresh-dependencies applyAllPatches | |
| - name: Build Paperclip Jar | |
| run: ./gradlew --refresh-dependencies createMojmapPaperclipJar | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: ${{ env.project_id_b }} CI Artifacts | |
| path: luminol-server/build/libs/*-paperclip-*-mojmap.jar | |
| - name: Set Environment | |
| if: github.event_name != 'pull_request' | |
| run: sh scripts/SetENV.sh | |
| - name: Clone Harebell | |
| if: github.event_name != 'pull_request' | |
| run: | | |
| git clone --depth 1 --branch Luminol https://github.com/MenthaMC/Harebell.git harebell | |
| - name: Build Harebell | |
| if: github.event_name != 'pull_request' | |
| working-directory: harebell | |
| run: | | |
| chmod +x gradlew | |
| ./gradlew --refresh-dependencies shadowJar | |
| - name: Check If Release Exists | |
| if: github.event_name != 'pull_request' && env.flag_release == 'true' | |
| run: | | |
| git fetch --tags | |
| if [ -n "$(git tag -l "${{ env.tag }}")" ]; then | |
| echo "Release already exists" | |
| release_exists=true | |
| else | |
| echo "Release does not exist" | |
| release_exists=false | |
| fi | |
| if [ "$release_exists" == "true" ]; then | |
| counter=1 | |
| while [ -n "$(git tag -l "${{ env.tag }}-${counter}")" ]; do | |
| counter=$((counter + 1)) | |
| done | |
| echo "tag=${{ env.tag }}-${counter}" >> $GITHUB_ENV | |
| echo "release_count= - ${counter}" >> $GITHUB_ENV | |
| fi | |
| echo "release_exists=${release_exists}" >> $GITHUB_ENV | |
| - name: Check If Branch In Expectations | |
| if: github.event_name != 'pull_request' | |
| run: | | |
| if [[ "$GITHUB_REF_NAME" == ver/* ]] || [[ "$GITHUB_REF_NAME" == exp/* ]] || [[ "$GITHUB_REF_NAME" == dev/* ]]; then | |
| echo "Branch is in expected prefixes" | |
| echo "unexpect=false" >> $GITHUB_ENV | |
| else | |
| echo "Branch is NOT in expected prefixes" | |
| echo "unexpect=true" >> $GITHUB_ENV | |
| fi | |
| - name: Prepare Push To Repo | |
| if: ( github.event_name != 'pull_request' && !( env.unexpect == 'true' ) && env.flag_release == 'true' && env.release_exists != 'true' && !( inputs.force-release == '2' )) && inputs.force-push != '1' && inputs.force-push != '2' | |
| continue-on-error: true | |
| run: | | |
| sh scripts/compareAPIStage1.sh | |
| sh scripts/getVersionNumber.sh | |
| sh scripts/compareAPIStage2.sh | |
| sh scripts/pushAPIVersionInfo.sh | |
| env: | |
| PUSH_TOKEN: ${{ secrets.PUSH_TOKEN }} | |
| PUSH_WEB: ${{ secrets.PUSH_WEB }} | |
| SHA: ${{ env.commit_id }} | |
| PROJECT_NAME: ${{ env.project_id_b }} | |
| MC_VERSION: ${{ env.mcversion }} | |
| PAT_SECRET: ${{ secrets.REPO_ACCESS_TOKEN }} | |
| - name: Publish To Repo | |
| if: (( github.event_name != 'pull_request' && !( env.unexpect == 'true' ) && env.flag_release == 'true' && env.release_exists != 'true' && !( inputs.force-release == '2' )) && env.need_push_API == 'true') || inputs.force-push == '1' | |
| continue-on-error: true | |
| run: ./gradlew --refresh-dependencies generateDevelopmentBundle publish -PpublishDevBundle=true | |
| env: | |
| PRIVATE_MAVEN_REPO_PASSWORD: ${{ secrets.PRIVATE_MAVEN_REPO_PASSWORD }} | |
| PRIVATE_MAVEN_REPO_USERNAME: ${{ secrets.PRIVATE_MAVEN_REPO_USERNAME }} | |
| - name: Create Release - Pre Process | |
| if: ( github.event_name != 'pull_request' && !( env.unexpect == 'true' ) && env.flag_release == 'true' && env.release_exists != 'true' && !(inputs.force-release == '2')) || inputs.force-release == '1' | |
| run: | | |
| if [ "${{ inputs.comments }}" == "" ]; then | |
| echo "No comments provided" | |
| echo "flag_comment=false" >> $GITHUB_ENV | |
| else | |
| echo "Comments provided: ${{ inputs.comments }}" | |
| echo "flag_comment=true" >> $GITHUB_ENV | |
| fi | |
| - name: Create Release - No Comment | |
| if: env.flag_comment == 'false' | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| tag: ${{ env.tag }} | |
| name: ${{ env.project_id_b }} ${{ env.mcversion }} - ${{ env.SUBVERSION }}${{ env.release_count }} | |
| body: | | |
| 📦Version: `${{ env.mcversion }}` | Commit ${{ env.commit_id }} [](https://github.com/LuminolMC/${{ env.project_id }}/releases/download/${{ env.tag }}/${{ env.jar }}) | |
| This release is automatically compiled by GitHub Actions | |
| ### Branch Info | |
| > ${{ github.ref_name }} | |
| ### Commit Message | |
| ${{ env.commit_msg }} | |
| ### API Version | |
| > ${{ env.EARLIEST_REMOTE_COMMIT }} | |
| artifacts: | | |
| ${{ env.jar_dir }} | |
| harebell/build/libs/harebell.jar | |
| generateReleaseNotes: true | |
| prerelease: ${{ env.pre }} | |
| makeLatest: ${{ env.make_latest }} | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create Release - With Comment | |
| if: env.flag_comment == 'true' | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| tag: ${{ env.tag }} | |
| name: ${{ env.project_id_b }} ${{ env.mcversion }} - ${{ env.SUBVERSION }}${{ env.release_count }} | |
| body: | | |
| 📦Version: `${{ env.mcversion }}` | Commit ${{ env.commit_id }} [](https://github.com/LuminolMC/${{ env.project_id }}/releases/download/${{ env.tag }}/${{ env.jar }}) | |
| This release is automatically compiled by GitHub Actions | |
| ### Comments | |
| > ${{ inputs.comments }} | |
| ### Branch Info | |
| > ${{ github.ref_name }} | |
| ### Commit Message | |
| ${{ env.commit_msg }} | |
| ### API Version | |
| > ${{ env.EARLIEST_REMOTE_COMMIT }} | |
| artifacts: | | |
| ${{ env.jar_dir }} | |
| harebell/build/libs/harebell.jar | |
| generateReleaseNotes: true | |
| prerelease: ${{ env.pre }} | |
| makeLatest: ${{ env.make_latest }} | |
| token: ${{ secrets.GITHUB_TOKEN }} |