gradle-publish.yml 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # This workflow uses actions that are not certified by GitHub.
  2. # They are provided by a third-party and are governed by
  3. # separate terms of service, privacy policy, and support
  4. # documentation.
  5. # This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
  6. # For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle
  7. name: Gradle Package
  8. on:
  9. push:
  10. branches:
  11. - master
  12. release:
  13. types: [created, edited, published]
  14. jobs:
  15. build:
  16. runs-on: ubuntu-latest
  17. permissions:
  18. contents: read
  19. packages: write
  20. steps:
  21. - uses: actions/checkout@v2
  22. - name: Set up JDK 17
  23. uses: actions/setup-java@v2
  24. with:
  25. java-version: '17'
  26. distribution: 'temurin'
  27. server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
  28. settings-path: ${{ github.workspace }} # location for the settings.xml file
  29. - name: Build with Gradle
  30. uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee
  31. with:
  32. arguments: build
  33. # The USERNAME and TOKEN need to correspond to the credentials environment variables used in
  34. # the publishing section of your build.gradle
  35. - name: Publish to GitHub Packages
  36. uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee
  37. with:
  38. arguments: publish
  39. env:
  40. USERNAME: ${{ github.actor }}
  41. TOKEN: ${{ secrets.GITHUB_TOKEN }}