-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set Modrinth and Curseforge IDs and try publishing.
- Loading branch information
Showing
5 changed files
with
290 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: 'Gradle Setup' | ||
description: 'Set up the basics to run gradle' | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Export release tag as environment variable | ||
shell: bash | ||
env: | ||
TAG: ${{ github.event.release.tag_name }} | ||
run: | | ||
echo "TAG=${TAG}" >> $GITHUB_ENV | ||
- uses: gradle/actions/wrapper-validation@v3 | ||
|
||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'microsoft' | ||
java-version: '21' | ||
|
||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v3 | ||
with: | ||
cache-read-only: ${{ github.ref != 'refs/heads/main' }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: 'Build and Test' | ||
|
||
on: | ||
push: | ||
# Only on branches, not tags/releases | ||
branches: | ||
- '**' | ||
pull_request: | ||
branches: | ||
- '*' | ||
|
||
# Cancel outdated builds for the same branch | ||
concurrency: | ||
group: ci-build-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
# Only run the pull-request build if the pull-request was opened from another repository, | ||
# since we already run this workflow for the branch the pull request was made from. | ||
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 50 | ||
- run: git fetch origin --tags | ||
shell: bash | ||
- uses: ./.github/actions/gradle-setup | ||
- name: Generate assets | ||
run: ./gradlew runData | ||
- name: Check that datagen ran | ||
run: test -d ./src/generated/resources/.cache | ||
- name: Make sure that generated files in the repo are up-to-date | ||
run: | | ||
# Print status for easier debugging | ||
git status | ||
if [ -n "$(git status --porcelain)" ]; then exit 1; fi | ||
# Gradle Step for PRs | ||
- name: Build PR with Gradle | ||
run: ./gradlew build | ||
env: | ||
PR_NUMBER: ${{ github.event.pull_request.number }} | ||
if: github.event_name == 'pull_request' | ||
# Gradle Step for normal branch pushes | ||
- name: Build PR with Gradle | ||
run: ./gradlew build | ||
if: github.event_name != 'pull_request' | ||
- name: Run Game Tests | ||
run: ./gradlew runGametest | ||
|
||
# Always upload test results | ||
- name: Merge Test Reports | ||
if: success() || failure() | ||
run: npx junit-report-merger junit.xml "**/TEST-*.xml" | ||
|
||
- uses: actions/upload-artifact@v4 | ||
if: success() || failure() | ||
with: | ||
name: test-results | ||
path: junit.xml | ||
|
||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: dist | ||
path: build/libs/ |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
name: 'Release' | ||
|
||
on: | ||
release: | ||
types: [ published ] | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
outputs: | ||
ARTIFACT_PATH: ${{ steps.prepare_artifact_metadata.outputs.ARTIFACT_PATH }} | ||
ARTIFACT_NAME: ${{ steps.prepare_artifact_metadata.outputs.ARTIFACT_NAME }} | ||
JAVADOC_PATH: ${{ steps.prepare_artifact_metadata.outputs.JAVADOC_PATH }} | ||
JAVADOC_NAME: ${{ steps.prepare_artifact_metadata.outputs.JAVADOC_NAME }} | ||
API_PATH: ${{ steps.prepare_artifact_metadata.outputs.API_PATH }} | ||
API_NAME: ${{ steps.prepare_artifact_metadata.outputs.API_NAME }} | ||
VERSION: ${{ steps.prepare_artifact_metadata.outputs.VERSION }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 50 | ||
- run: git fetch origin --tags | ||
shell: bash | ||
- uses: ./.github/actions/gradle-setup | ||
- name: Build with Gradle | ||
run: ./gradlew printProjectVersion build publish -x check --max-workers 1 | ||
- name: Prepare artifact metadata. Note that VERSION is set by the gradle script. | ||
id: prepare_artifact_metadata | ||
run: | | ||
echo ARTIFACT_PATH=./build/libs/guideme-${VERSION}.jar >> $GITHUB_OUTPUT | ||
echo ARTIFACT_NAME=guideme-${VERSION}.jar >> $GITHUB_OUTPUT | ||
echo JAVADOC_PATH=./build/libs/guideme-${VERSION}-javadoc.jar >> $GITHUB_OUTPUT | ||
echo JAVADOC_NAME=guideme-${VERSION}-javadoc.jar >> $GITHUB_OUTPUT | ||
echo API_PATH=./build/libs/guideme-${VERSION}-api.jar >> $GITHUB_OUTPUT | ||
echo API_NAME=guideme-${VERSION}-api.jar >> $GITHUB_OUTPUT | ||
echo VERSION=${VERSION} >> $GITHUB_OUTPUT | ||
- name: Archive build results | ||
run: tar -I zstd -cf build.tar.zst build/libs build/repo | ||
- name: Upload build and gradle folders | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: build-artifacts | ||
path: build.tar.zst | ||
if-no-files-found: error | ||
retention-days: 3 | ||
|
||
upload-release-artifacts: | ||
name: Upload Release Artifacts | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download build artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: build-artifacts | ||
- name: Unpack build artifact | ||
run: tar axf build.tar.zst | ||
- name: Upload Release Artifact | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ github.event.release.upload_url }} | ||
asset_path: ${{ needs.build.outputs.ARTIFACT_PATH }} | ||
asset_name: ${{ needs.build.outputs.ARTIFACT_NAME }} | ||
asset_content_type: application/zip | ||
- name: Upload Javadocs Artifact | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ github.event.release.upload_url }} | ||
asset_path: ${{ needs.build.outputs.JAVADOC_PATH }} | ||
asset_name: ${{ needs.build.outputs.JAVADOC_NAME }} | ||
asset_content_type: application/zip | ||
- name: Upload API | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ github.event.release.upload_url }} | ||
asset_path: ${{ needs.build.outputs.API_PATH }} | ||
asset_name: ${{ needs.build.outputs.API_NAME }} | ||
asset_content_type: application/zip | ||
|
||
deploy-github-packages: | ||
name: Deploy to Github Packages | ||
needs: build | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
steps: | ||
- name: Download build artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: build-artifacts | ||
- name: Unpack build artifact | ||
run: tar axf build.tar.zst | ||
- name: Validate artifacts exist | ||
run: test -d ./build | ||
- name: Publish to Github Packages | ||
uses: AppliedEnergistics/maven-publish-action@main | ||
with: | ||
local-repository-path: build/repo | ||
remote-repository-url: https://maven.pkg.github.com/AppliedEnergistics/Applied-Energistics-2/ | ||
remote-repository-username: ${{ github.actor }} | ||
remote-repository-password: ${{ github.token }} | ||
|
||
deploy-curseforge: | ||
name: Deploy to Curseforge | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download build artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: build-artifacts | ||
- name: Unpack build artifact | ||
run: tar axf build.tar.zst | ||
- name: Validate artifacts exist | ||
run: test -d ./build | ||
- name: Upload to Curseforge | ||
uses: Kir-Antipov/mc-publish@995edadc13559a8b28d0b7e6571229f067ec7659 | ||
with: | ||
name: GuideME ${{ needs.build.outputs.VERSION }} | ||
version: ${{ needs.build.outputs.VERSION }} | ||
files: ${{ needs.build.outputs.ARTIFACT_PATH }} | ||
curseforge-id: 1173950 | ||
curseforge-token: ${{ secrets.CURSEFORGE }} | ||
loaders: neoforge | ||
|
||
deploy-modmaven: | ||
name: Deploy to Modmaven | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download build artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: build-artifacts | ||
- name: Unpack build artifact | ||
run: tar axf build.tar.zst | ||
- name: Validate artifacts exist | ||
run: test -d ./build | ||
- name: Publish to Modmaven | ||
uses: AppliedEnergistics/maven-publish-action@main | ||
with: | ||
local-repository-path: build/repo | ||
remote-repository-url: https://modmaven.dev/artifactory/local-releases/ | ||
remote-repository-username: ${{ secrets.MODMAVEN_USER }} | ||
remote-repository-password: ${{ secrets.MODMAVEN_PASSWORD }} | ||
|
||
deploy-modrinth: | ||
name: Deploy to Modrinth | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download build artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: build-artifacts | ||
- name: Unpack build artifact | ||
run: tar axf build.tar.zst | ||
- name: Validate artifacts exist | ||
run: test -d ./build | ||
- name: Upload to Modrinth | ||
uses: Kir-Antipov/mc-publish@995edadc13559a8b28d0b7e6571229f067ec7659 | ||
with: | ||
name: GuideME ${{ needs.build.outputs.VERSION }} | ||
version: ${{ needs.build.outputs.VERSION }} | ||
files: ${{ needs.build.outputs.ARTIFACT_PATH }} | ||
modrinth-id: Ck4E7v7R | ||
modrinth-token: ${{ secrets.MODRINTH }} | ||
loaders: neoforge |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: 'Test Report' | ||
on: | ||
workflow_run: | ||
workflows: ['Build Pull Request'] | ||
types: | ||
- completed | ||
permissions: | ||
contents: read | ||
actions: read | ||
checks: write | ||
jobs: | ||
report: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: dorny/test-reporter@afe6793191b75b608954023a46831a3fe10048d4 | ||
with: | ||
artifact: test-results | ||
name: Test Report | ||
path: '**/*.xml' | ||
reporter: java-junit | ||
# This should not affect the result of the check created | ||
# for the origin PR. This just affects this post-processing job itself. | ||
continue-on-error: true |
This file contains 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