Your repository -> Settings -> Security -> Secrets and variables -> Actions
:${{ secrets.VARIABLE }}
.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)
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 }}"
}]
Did you find misleading or deprecated content? Maybe you just feel this section misses important elements?
Copyright © 2023 dzikoysk with ❤ panda-lang