deploy to Github Package Registry from Github Action

后端 未结 5 1626
暗喜
暗喜 2020-12-16 16:10

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]
         


        
5条回答
  •  抹茶落季
    2020-12-16 16:12

    There is an easier way in 2020.

    First, add distribution configuration to your pom.xml:

    
     
      github
      GitHub OWNER Apache Maven Packages
      https://maven.pkg.github.com/OWNER/REPOSITORY
     
    
    

    The id must be github.

    Second, use actions/setup-java@v1 in action

    steps:
      - uses: actions/checkout@v2
    
      - uses: actions/setup-java@v1
        with:
          java-version: 1.8
    
      - name: Publish to GitHub Packages
        env:
          GITHUB_TOKEN: ${{ github.token }}
        run: mvn deploy
    

提交回复
热议问题