https://maven.hexxy.media is a public Maven repository run by me (object-Object, or leftsquarebracket on Discord) and hosted on Azure Artifacts. Hex Casting community members are welcome to use it for publishing projects related to Hex Casting.
- Please be reasonable about how often you publish to this repository. Ideally, only publish named releases. If you're planning on uploading a large number of snapshots (especially if you'll be publishing on every push), please ask first. This repository is hosted on Azure Artifacts, so there's a limited amount of space available before I have to start paying for it.
- Test your Gradle publishing configuration ahead of time. Azure Artifacts is immutable, so you can't modify versions after they've been published; it's possible to yank/delete a version if necessary, but you'll need to increment the version number before re-publishing. You can test the publishing process locally by running the
publishToMavenLocaltask and looking in~/.m2/repository, or in GitHub Actions by running the release workflow in dry run mode.
These instructions assume that your project is hosted in a GitHub repository. If you're using a different Git host, or if you'd like to use a different OIDC-supporting CI/CD provider instead of GitHub Actions, send me a DM.
- Add the repository to your publishing block:
publishing { repositories { maven { url = uri("https://pkgs.dev.azure.com/hexxy-media/artifacts/_packaging/community/maven/v1") credentials { username = "hexxy-media" password = System.getenv("MAVEN_PASSWORD") } } } publications { // ... } }- Make sure to use the actual URL here -
https://maven.hexxy.mediais a redirect, which causes the authentication process to fail. - If you don't have a
publishingblock, follow Gradle's setup guide to add one. Projects based on HexDummy should add it tobuildSrc/src/main/kotlin/.../minecraft.gradle.kts; Groovy-based projects should add it to thesubprojectsblock in the top-levelbuild.gradle.
- Make sure to use the actual URL here -
- Run the
publishToMavenLocaltask to make sure your project is configured properly.- For example, if your mod's Maven coordinates are
com.example.examplemod:examplemod-fabric:1.0.0+1.20.1, the built mod should be published to~/.m2/repository/com/example/examplemod/examplemod-fabric/1.0.0+1.20.1/examplemod-common-1.0.0+1.20.1.jar.
- For example, if your mod's Maven coordinates are
- Add a new file to your repository at
.github/workflows/release.ymlwith the following content (or merge it into your existing release workflow, if you have one):name: Release on: workflow_dispatch: inputs: publish_maven: description: Publish to Maven type: boolean default: true dry_run: description: Perform a dry run type: boolean default: false jobs: publish-maven: if: inputs.publish_maven runs-on: ubuntu-latest environment: name: ${{ !inputs.dry_run && 'maven' || '' }} permissions: contents: read id-token: write steps: - uses: actions/checkout@v4 - uses: actions/setup-java@v4 with: distribution: temurin java-version: 17 - uses: gradle/actions/setup-gradle@v4 - name: Build mod run: ./gradlew build - name: Login to Azure if: inputs.dry_run == false uses: azure/login@v2 with: client-id: ${{ secrets.AZURE_CLIENT_ID }} tenant-id: ${{ secrets.AZURE_TENANT_ID }} subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} - name: Get Azure access token id: get-token if: inputs.dry_run == false run: | token=$(az account get-access-token --query accessToken --resource 499b84ac-1321-427f-aa17-267ca6975798 --output tsv) echo "::add-mask::$token" echo "token=$token" >> "$GITHUB_OUTPUT" - name: Publish to ${{ inputs.dry_run && 'Maven Local' || 'Maven' }} env: MAVEN_PASSWORD: ${{ steps.get-token.outputs.token }} run: ./gradlew ${{ inputs.dry_run && 'publishToMavenLocal' || 'publish' }} - name: Upload dry run artifact if: inputs.dry_run uses: actions/upload-artifact@v4 with: name: maven-dry-run path: ~/.m2/repository/com/example/examplemod # TODO: fill in the correct path for your mod if-no-files-found: error
- In your GitHub repository, navigate to Settings > Environments and create a new environment called
maven.- You can use a different name if you want; just make sure to change it in the release workflow as well.
- Open an issue in the
object-Object/hexxy.mediarepository to request publishing permissions. I'll send you the following values; add them as environment secrets (not variables) to the GitHub environment that you created:AZURE_CLIENT_IDAZURE_TENANT_IDAZURE_SUBSCRIPTION_ID
- When you're ready, you can now publish your mod to the Maven repository by running the release workflow manually.