diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b3a6dc8c..7c208682 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,5 +6,25 @@ on: jobs: build: - uses: TwelveIterationMods/Workflows/.github/workflows/publish-snapshot.yml@v2 - secrets: inherit + runs-on: ubuntu-latest + strategy: + matrix: + loader: [fabric, forge, neoforge] + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Validate gradle wrapper + uses: gradle/wrapper-validation-action@v1 + - name: Setup JDK + uses: actions/setup-java@v3 + with: + java-version: 21 + distribution: temurin + - name: Make gradle wrapper executable + run: chmod +x ./gradlew + - name: Build + run: ./gradlew :${{ matrix.loader }}:build + env: + GPR_USERNAME: ${{secrets.GPR_USERNAME}} + GPR_TOKEN: ${{secrets.GPR_TOKEN}} + GPR_BUILD_NUMBER: ${{github.run_number}} \ No newline at end of file diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml deleted file mode 100644 index ca6d3065..00000000 --- a/.github/workflows/create-release.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: create-release -on: - workflow_dispatch: - inputs: - bump: - description: 'The bump in version for this release' - required: true - type: choice - default: patch - options: - - major - - minor - - patch - - none - -jobs: - create-release: - uses: TwelveIterationMods/Workflows/.github/workflows/create-release.yml@v2 - with: - bump: ${{ github.event.inputs.bump }} - secrets: inherit diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml new file mode 100644 index 00000000..d128df43 --- /dev/null +++ b/.github/workflows/publish-release.yml @@ -0,0 +1,78 @@ +name: publish-release +on: + workflow_dispatch: + inputs: + bump: + description: 'The bump in version for this release' + required: true + type: choice + default: patch + options: + - major + - minor + - patch + +jobs: + create-release: + runs-on: ubuntu-latest + outputs: + ref: v${{ steps.bump-version.outputs.version }} + version: ${{ steps.bump-version.outputs.version }} + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Extracting version from properties + shell: bash + run: echo "version=$(cat gradle.properties | grep -w "\bversion" | cut -d= -f2)" >> $GITHUB_OUTPUT + id: extract-version + - name: Bumping version + uses: TwelveIterationMods/bump-version@v1 + with: + version: ${{ steps.extract-version.outputs.version }} + bump: ${{ inputs.bump }} + id: bump-version + - name: Updating version properties + run: | + sed -i "s/^\s*version\s*=.*/version = ${{ steps.bump-version.outputs.version }}/g" gradle.properties + git config user.name "GitHub Actions" + git config user.email "<>" + git commit -am "Set version to ${{ steps.bump-version.outputs.version }}" + git push origin ${BRANCH_NAME} + git tag -a "v${{ steps.bump-version.outputs.version }}" -m "Release ${{ steps.bump-version.outputs.version }}" + git push origin "v${{ steps.bump-version.outputs.version }}" + shell: bash + env: + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} + publish-release: + runs-on: ubuntu-latest + permissions: + packages: write + strategy: + matrix: + loader: [ common, fabric, forge, neoforge ] + site: [ curseforge, modrinth, publish ] + exclude: + - loader: shared + site: curseforge + - loader: shared + site: modrinth + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + ref: ${{ needs.create-release.outputs.ref }} + - name: Validate gradle wrapper + uses: gradle/wrapper-validation-action@v1 + - name: Setup JDK + uses: actions/setup-java@v3 + with: + java-version: 21 + distribution: temurin + - name: Make gradle wrapper executable + run: chmod +x ./gradlew + - name: Publish + run: ./gradlew :${{ matrix.loader }}:${{ matrix.site }} '-Pversion=${{needs.create-release.outputs.version}}' '-PtwelveIterationsNexusUsername=${{ secrets.NEXUS_USER }}' '-PtwelveIterationsNexusPassword=${{ secrets.NEXUS_PASSWORD }}' + env: + CURSEFORGE_TOKEN: ${{secrets.CURSEFORGE_TOKEN}} + MODRINTH_TOKEN: ${{secrets.MODRINTH_TOKEN}} + needs: create-release \ No newline at end of file diff --git a/.github/workflows/publish-snapshot.yml b/.github/workflows/publish-snapshot.yml new file mode 100644 index 00000000..9b366875 --- /dev/null +++ b/.github/workflows/publish-snapshot.yml @@ -0,0 +1,38 @@ +name: publish-snapshot +on: + push: + tags: + - '*' + +jobs: + publish-snapshot: + runs-on: ubuntu-latest + permissions: + packages: write + strategy: + matrix: + loader: [common, fabric, forge, neoforge] + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Validate gradle wrapper + uses: gradle/wrapper-validation-action@v1 + - name: Setup JDK + uses: actions/setup-java@v3 + with: + java-version: 21 + distribution: temurin + - name: Make gradle wrapper executable + run: chmod +x ./gradlew + - name: Extracting version from properties + shell: bash + run: echo "version=$(cat gradle.properties | grep -w "\bversion" | cut -d= -f2)" >> $GITHUB_OUTPUT + id: extract-version + - name: Bumping version + uses: TwelveIterationMods/bump-version@v1 + with: + version: ${{ steps.extract-version.outputs.version }} + bump: minor + id: bump-version + - name: Publish + run: ./gradlew :${{ matrix.loader }}:publish '-Pversion=${{ steps.bump-version.outputs.version }}-SNAPSHOT' '-PtwelveIterationsNexusUsername=${{ secrets.NEXUS_USER }}' '-PtwelveIterationsNexusPassword=${{ secrets.NEXUS_PASSWORD }}' \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index b4794e77..00000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: publish -on: - push: - tags: - - '*' - -jobs: - publish: - uses: TwelveIterationMods/Workflows/.github/workflows/publish-release.yml@v2 - secrets: inherit \ No newline at end of file