I would like to deploy to a GitHub Package Registry from a GitHub Action of a public repo.
I have a yml file for a workflow:
name: My CI
on: [push]
To make it work, you need to do two things:
github
GitHub OWNER Apache Maven Packages
https://maven.pkg.github.com/OWNER/REPOSITORY
source: https://help.github.com/en/articles/configuring-apache-maven-for-use-with-github-package-registry#publishing-a-package
name: Java CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Deploy to Github Package Registry
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mkdir ~/.m2
echo "github OWNER ${GITHUB_TOKEN} " > ~/.m2/settings.xml
mvn deploy
Unfortunately, I don't think you can pass the username/password as arguments to Maven and so you need to set up the settings file instead. source: Is it possible to pass a password in Maven Deploy in the command line?
Lastly, I confirm that this only works for non-SNAPSHOT artifacts. When I try deploying a SNAPSHOT version it fails with a 400 error as described.