From 3efaba177fade7f8ee56e780e4bf7decd7933e78 Mon Sep 17 00:00:00 2001 From: bridge Date: Sat, 1 Mar 2025 14:11:27 +0100 Subject: [PATCH] feat: CI --- .gitea/workflows/build.yml | 29 ++++++++++++ .github/workflows/close-invalid-prs.yml | 29 ------------ .github/workflows/dev-build-release.yml | 46 ------------------- .../entitylib.library-conventions.gradle.kts | 11 +++-- 4 files changed, 36 insertions(+), 79 deletions(-) create mode 100644 .gitea/workflows/build.yml delete mode 100644 .github/workflows/close-invalid-prs.yml delete mode 100644 .github/workflows/dev-build-release.yml diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..d8aec33 --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,29 @@ +name: Build + +on: + workflow_dispatch: + push: + branches: ['*'] + pull_request: + branches: ['*'] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Clone project + uses: actions/checkout@v4 + + - name: Install JDK 8 + uses: actions/setup-java@v4 + with: + java-version: '8' + distribution: 'temurin' + check-latest: true + + - name: Setup gradle + uses: gradle/actions/setup-gradle@v4 + + - name: Run build & publish with Gradle Wrapper + if: gitea.ref == 'refs/heads/master' + run: chmod +x ./gradlew && ./gradlew build publishAllPublicationsToMavenRepository -PnetheriteRepoUsername=${{ secrets.REPOSILITE_USER }} -PnetheriteRepoPassword=${{ secrets.REPOSILITE_PASSWORD }} \ No newline at end of file diff --git a/.github/workflows/close-invalid-prs.yml b/.github/workflows/close-invalid-prs.yml deleted file mode 100644 index bf9fa73..0000000 --- a/.github/workflows/close-invalid-prs.yml +++ /dev/null @@ -1,29 +0,0 @@ -# Thanks paper: https://github.com/papermc/paper/blob/master/.github/workflows/close_invalid_prs.yml -name: Close invalid PRs - -on: - pull_request_target: - types: [ opened ] - -jobs: - run: - name: Close invalid PRs - if: | - github.repository != github.event.pull_request.head.repo.full_name && - ( - github.head_ref == 'master' || - github.event.pull_request.head.repo.owner.type != 'User' - ) - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - id: "master_branch" - if: github.head_ref == 'master' - with: - comment: "Please do not open pull requests from the `master` branch, create a new branch instead." - - - uses: superbrothers/close-pull-request@v3 - id: "org_account" - if: github.event.pull_request.head.repo.owner.type != 'User' && steps.master_branch.outcome == 'skipped' - with: - comment: "Please do not open pull requests from non-user accounts like organisations. Create a fork on a user account instead." diff --git a/.github/workflows/dev-build-release.yml b/.github/workflows/dev-build-release.yml deleted file mode 100644 index 237e53d..0000000 --- a/.github/workflows/dev-build-release.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Build - -on: - workflow_dispatch: - push: - branches: ['*'] - pull_request: - branches: ['*'] - -permissions: - contents: write - -jobs: - build: - runs-on: ubuntu-latest - env: - TYCOONS_REPO_USER: ${{ secrets.EVOKE_REPO_USERNAME }} - TYCOONS_REPO_PASS: ${{ secrets.EVOKE_REPO_PASSWORD }} - steps: - - name: Clone project - uses: actions/checkout@v4 - - - name: Install JDK 8 - uses: actions/setup-java@v4 - with: - java-version: '8' - distribution: 'temurin' - check-latest: true - - - name: Setup gradle - uses: gradle/actions/setup-gradle@v4 - - - name: Run build & publish with Gradle Wrapper - if: github.ref == 'refs/heads/master' - run: chmod +x ./gradlew && ./gradlew publishAllPublicationsToMavenRepository - - - name: Run build with Gradle Wrapper - if: github.ref != 'refs/heads/master' - run: chmod +x ./gradlew && ./gradlew build - - - name: Create Release - uses: softprops/action-gh-release@v2 - with: - name: '${{ github.ref_name }}: ${{ github.event.head_commit.message }} (${{ github.sha }})' - prerelease: ${{ github.ref != 'refs/heads/master' }} - tag_name: ${{ github.ref_name }}-${{ github.sha }} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/entitylib.library-conventions.gradle.kts b/buildSrc/src/main/kotlin/entitylib.library-conventions.gradle.kts index 7c00174..11e57b4 100644 --- a/buildSrc/src/main/kotlin/entitylib.library-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/entitylib.library-conventions.gradle.kts @@ -48,10 +48,13 @@ publishing { repositories { maven { - url = uri("https://maven.evokegames.gg/snapshots") - credentials { - username = System.getenv("TYCOONS_REPO_USER") - password = System.getenv("TYCOONS_REPO_PASS") + url = uri("https://git.netherite.gg/api/packages/Netherite-Public/maven") + credentials(HttpHeaderCredentials) { + name = "Authorization" + value = "token ${project.properties["netherite.git.packages.token"]}" + } + authentication { + header(HttpHeaderAuthentication) } } }