Skip to content

Using github actions to publish to github package repository #25916

Answered by Yanjingzhu
jtratner asked this question in Actions
Discussion options

You must be logged in to vote

Did you get 401 message in step " push to github packages with maven" ? 

When you try to deploy maven package in your workflow, you could use a specific settings.xml including your personal access token . You could store the PAT in secrets and use it as an environment variable value when run mvn deploy command. 

Please see my example here: 

name: deploy maven package
on: push
jobs:
  job1:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - run: mvn deploy --settings settings.xml
      env:
        PackagePAT: ${{secrets.PackagePAT}}

In my repo, I have a settings.xml in the root . In servers section, I set ${env.PackagePAT} as the password. 

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Actions Build, test, and automate your deployment pipeline with world-class CI/CD Product Feedback
3 participants