Table of Contents

Before you can start working with , you have to add access token to your environment. You can do this in Your repository -> Settings -> Security -> Secrets and variables -> Actions:
GitHub Actions :: Secret
Defined variables can be used in workflow files using the given syntax: ${{ secrets.VARIABLE }}.

Configure workflow task that builds your project and then deploys it to your Reposilite instance with the following setup:
name: Publish project to Maven repository
# Publish manually
on: workflow_dispatch
# OR, publish per each commit
on:
  push:
    branches: [ main ]
jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK
        uses: actions/setup-java@v1
        with:
          java-version: 18
      - name: Grant execute permission for gradlew
        run: chmod +x gradlew
      - name: Publish with Gradle
        run: ./gradlew build publish
        env:
          MAVEN_NAME: ${{ secrets.MAVEN_NAME }} # token name
          MAVEN_SECRET: ${{ secrets.MAVEN_SECRET }} # token secret (password)
You can find full list of available events in GitHub Actions documentation:

Because Maven does not support server credentials section in the pom.xml file, you have to somehow provide ~/.m2/settings.xml to your CI process. I can recommend plugin to generate such file during execution, without a need to write a custom script.
- uses: s4u/maven-settings-[email protected]
  with:
    servers: |
      [{
        "id": "reposilite-repository",
        "username": "${{ secrets.MAVEN_NAME }}",
        "password": "${{ secrets.MAVEN_SECRET }}"
      }]
If you don't want to use such plugin, or you can't, just link/generate the settings file using any other tool you want.

Did you find misleading or deprecated content? Maybe you just feel this section misses important elements?

Guide

Copyright © 2023 dzikoysk with ❤ panda-lang