diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..a7b1fc2 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +*.* @PlazmaMC/CoreTeam diff --git a/.github/assets/logo.png b/.github/assets/logo.png new file mode 100644 index 0000000..758ac99 Binary files /dev/null and b/.github/assets/logo.png differ diff --git a/.github/assets/title.png b/.github/assets/title.png new file mode 100644 index 0000000..569647e Binary files /dev/null and b/.github/assets/title.png differ diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..b414612 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,13 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + target-branch: "*" + schedule: + interval: "daily" + + - package-ecosystem: "gradle" + directory: "/" + target-branch: "*" + schedule: + interval: "daily" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..b8faa36 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,107 @@ +name: Build Plazma + +on: + push: + branches: [ "ver/*", "feat/*", "dev/*", "expr/*", "ench/*", "impl/*" ] + workflow_dispatch: + +env: + ORG_NAME: PlazmaMC + MC_VERSION: 1.20.1 + MAIN_BRANCH: ver/1.20.1 + DEBUG: 'false' + +jobs: + release: + strategy: + matrix: + base_jdk: [17] + graal: [latest] + os: [ubuntu-22.04] + + if: "!startsWith(github.event.commits[0].message, '[CI-Skip]')" + runs-on: ${{ matrix.os }} + steps: + - name: Checkout action + uses: actions/checkout@v3 + + - name: Checkout pages + uses: actions/checkout@v3 + with: + path: javadoc + ref: gh-pages + token: ${{ secrets.GH_PAT }} + + - name: Validate Gradle Wrapper + uses: gradle/wrapper-validation-action@v1 + + - name: Set up GraalVM ${{ matrix.base_jdk }} + uses: graalvm/setup-graalvm@v1 + with: + github-token: ${{ secrets.GH_PAT }} + java-version: ${{ matrix.base_jdk }} + version: ${{ matrix.graal }} + cache: 'gradle' + + - name: Configure Git + run: git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" && git config --global user.name "github-actions[bot]" + + - name: Apply Patches + run: ./gradlew applyPatches --stacktrace + + - name: Build + run: ./gradlew build --stacktrace + + - name: Create Reobf Jar + run: ./gradlew createReobfPaperclipJar --stacktrace + + - name: Create Mojmap Jar + run: ./gradlew createMojmapPaperclipJar --stacktrace + + - name: Update Javadoc + continue-on-error: true + if: github.ref_name == env.MAIN_BRANCH + run: | + (cd Plazma-API/build/docs/javadoc && tar c .) | (cd javadoc && tar xf -) + cd javadoc + git add . && git commit -m "Update Javadocs" + git push + + - name: Publish Packages + if: github.ref_name == env.MAIN_BRANCH + run: | + export GITHUB_USERNAME=${{ env.ORG_NAME }} + export GITHUB_TOKEN=${{ secrets.GH_PAT }} + ./gradlew publish --stacktrace + + - name: Upload Artifacts + if: env.DEBUG == 'true' || !startsWith(github.ref_name, 'ver/') + uses: actions/upload-artifact@v3 + with: + name: Artifacts + path: | + build/libs + Plazma-API/build/docs/javadoc + + - name: Get Release Number + run: echo "RELEASE=$(git ls-remote --tags origin | grep "release" | wc -l)" >> $GITHUB_ENV + + - name: Release Artifacts + if: startsWith(github.ref_name, 'ver/') + uses: marvinpinto/action-automatic-releases@latest + with: + title: "Release #${{ env.RELEASE }}" + automatic_release_tag: release-${{ env.RELEASE }} + repo_token: "${{ secrets.GH_PAT }}" + files: build/libs/*.jar + prerelease: false + + - name: Release Artifacts (Latest) + if: startsWith(github.ref_name, 'ver/') + uses: marvinpinto/action-automatic-releases@latest + with: + title: "Release #${{ env.RELEASE }}" + automatic_release_tag: latest-${{ env.MC_VERSION }} + repo_token: "${{ secrets.GH_PAT }}" + files: build/libs/*.jar + prerelease: false diff --git a/.github/workflows/close-invalid-prs.yml b/.github/workflows/close-invalid-prs.yml new file mode 100644 index 0000000..62d0fdd --- /dev/null +++ b/.github/workflows/close-invalid-prs.yml @@ -0,0 +1,14 @@ +name: Close invalid PRs + +on: + pull_request_target: + types: [ opened ] + +jobs: + run: + if: ${{ github.repository != github.event.pull_request.head.repo.full_name && !startsWith(github.head_ref, 'ver/') }} + runs-on: ubuntu-22.04 + steps: + - uses: superbrothers/close-pull-request@v3 + with: + comment: "Please do not open pull requests from the `master` branch, create a new branch instead." diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml new file mode 100644 index 0000000..4657bfc --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,37 @@ +name: Test Gradle build script + +on: + push: + branches: [ "ver/*", "feat/*", "dev/*", "expr/*", "ench/*", "impl/*" ] + workflow_dispatch: + +jobs: + release: + strategy: + matrix: + jdk: [19.0.2+7] + java: ['temurin'] + os: [ubuntu-22.04] + + if: "!contains(github.event.commits[0].message, '[CheckSkip]')" + runs-on: ${{ matrix.os }} + steps: + - name: Checkout action + uses: actions/checkout@v3 + + - name: Validate Gradle Wrapper + uses: gradle/wrapper-validation-action@v1 + + - name: Set up JDK ${{ matrix.java }} ${{ matrix.jdk }} + uses: actions/setup-java@v3 + with: + distribution: ${{ matrix.java }} + java-version: ${{ matrix.jdk }} + cache: 'gradle' + + - name: Configure Git + run: | + git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" && git config --global user.name "github-actions[bot]" + + - name: Run Gradle + run: ./gradlew --stacktrace diff --git a/.github/workflows/javadocs.yml b/.github/workflows/javadocs.yml new file mode 100644 index 0000000..93742fc --- /dev/null +++ b/.github/workflows/javadocs.yml @@ -0,0 +1,46 @@ +name: Deploy Javadocs + +on: + push: + branches: ["gh-pages"] + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: true + +jobs: + build: + if: "!startsWith(github.event.commits[0].message, '[CI-Skip]')" + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Pages + uses: actions/configure-pages@v3 + + - name: Build with Jekyll + uses: actions/jekyll-build-pages@v1 + with: + source: ./ + destination: ./_site + + - name: Upload artifact + uses: actions/upload-pages-artifact@v1 + + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v1 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..47e0781 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,36 @@ +name: Test build with Normal JDK + +on: + push: + branches: [ "ver/*", "feat/*", "dev/*", "expr/*", "ench/*", "impl/*" ] + workflow_dispatch: + +jobs: + release: + strategy: + matrix: + jdk: [19.0.2+7] + java: ['temurin'] + os: [ubuntu-22.04] + + if: "!startsWith(github.event.commits[0].message, '[CI-Skip]')" + runs-on: ${{ matrix.os }} + steps: + - name: Checkout action + uses: actions/checkout@v3 + + - name: Validate Gradle Wrapper + uses: gradle/wrapper-validation-action@v1 + + - name: Set up JDK ${{ matrix.java }} ${{ matrix.jdk }} + uses: actions/setup-java@v3 + with: + distribution: ${{ matrix.java }} + java-version: ${{ matrix.jdk }} + cache: 'gradle' + + - name: Test build + run: | + git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" && git config --global user.name "github-actions[bot]" + ./gradlew applyPatches --stacktrace + ./gradlew build --stacktrace