From 5493b2961f2996e3276ba973a1d3b662cb52676e Mon Sep 17 00:00:00 2001 From: ZigyTheBird <105124180+ZigyTheBird@users.noreply.github.com> Date: Fri, 31 Jan 2025 13:14:33 +0330 Subject: [PATCH] New GitHub workflow --- .github/workflows/maven.yml | 29 +++++++++++++++ .github/workflows/mavenbuild.yml | 61 ++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 .github/workflows/maven.yml create mode 100644 .github/workflows/mavenbuild.yml diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml new file mode 100644 index 0000000..25255ff --- /dev/null +++ b/.github/workflows/maven.yml @@ -0,0 +1,29 @@ +name: Publish to maven repository. + +on: + workflow_dispatch: + inputs: + branch: + type: choice + description: Which branch do you want to publish? + options: + - 1.21 + - 1.20.4 + - 1.20.1 + forge: + type: choice + description: NeoForge or Forge? + options: + - neoforge + - forge + +jobs: + build_dev: + uses: zigythebird/zigysplayeranimatorapi/.github/workflows/mavenbuild.yml@1.21 + with: + branch: ${{ inputs.branch }} + GITHUB_REF: ${{ github.ref }} + upload_docs: true + forge: ${{ inputs.forge }} + secrets: + MAVEN_TOKEN: ${{ secrets.MAVEN_TOKEN }} diff --git a/.github/workflows/mavenbuild.yml b/.github/workflows/mavenbuild.yml new file mode 100644 index 0000000..b601547 --- /dev/null +++ b/.github/workflows/mavenbuild.yml @@ -0,0 +1,61 @@ +on: + workflow_call: + inputs: + branch: + required: true + type: string + GITHUB_REF: + required: true + type: string + upload_docs: + required: true + type: boolean + forge: + required: true + type: string + secrets: + MAVEN_TOKEN: + required: true + + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout Branch + uses: actions/checkout@v3 + with: + ref: ${{ inputs.branch }} + + - name: Restore gradle.properties + shell: bash + env: + MAVEN_TOKEN: ${{ secrets.MAVEN_TOKEN }} + run: | + mkdir -p ~/.gradle/ + echo "GRADLE_USER_HOME=${HOME}/.gradle" >> $GITHUB_ENV + echo "${MAVEN_TOKEN}" > ~/.gradle/gradle.properties + + - name: Get Artifact Id + uses: actions/github-script@v5 + id: artifact_id + env: + branch: '${{ inputs.branch }}' + with: + result-encoding: string + script: | + // use env branch replace / with _ + return process.env.branch.replace(/\//g, '_') + + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: 'adopt' + java-version: 21 + + - name: Grant Execute Permission + run: chmod +x gradlew + + - name: Build + run: | + ./gradlew publishMavenJavaPublicationToMavenRepository \ No newline at end of file