Skip to content

Instantly share code, notes, and snippets.

@object-Object
Last active October 9, 2025 00:52
Show Gist options
  • Select an option

  • Save object-Object/f9988135bec5cef653c668712954f429 to your computer and use it in GitHub Desktop.

Select an option

Save object-Object/f9988135bec5cef653c668712954f429 to your computer and use it in GitHub Desktop.
Publishing to maven.hexxy.media

Publishing to maven.hexxy.media

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.

Usage Guidelines

  • 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 publishToMavenLocal task and looking in ~/.m2/repository, or in GitHub Actions by running the release workflow in dry run mode.

Setup Instructions

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.

  1. 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.media is a redirect, which causes the authentication process to fail.
    • If you don't have a publishing block, follow Gradle's setup guide to add one. Projects based on HexDummy should add it to buildSrc/src/main/kotlin/.../minecraft.gradle.kts; Groovy-based projects should add it to the subprojects block in the top-level build.gradle.
  2. Run the publishToMavenLocal task 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.
  3. Add a new file to your repository at .github/workflows/release.yml with 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
  4. 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.
  5. Open an issue in the object-Object/hexxy.media repository 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_ID
    • AZURE_TENANT_ID
    • AZURE_SUBSCRIPTION_ID
  6. When you're ready, you can now publish your mod to the Maven repository by running the release workflow manually.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment