push.yml 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. name: Build and Release
  2. on:
  3. push:
  4. paths:
  5. - '**.gradle'
  6. - '**.properties'
  7. - '**/src/**'
  8. branches:
  9. - "1.16"
  10. - "1.17"
  11. workflow_dispatch:
  12. inputs:
  13. norelease:
  14. description: 'Do not publish'
  15. required: true
  16. default: 'false'
  17. jobs:
  18. build:
  19. strategy:
  20. matrix:
  21. java: [ 8-jdk, 11-jdk, 15-jdk ]
  22. runs-on: ubuntu-20.04
  23. container:
  24. image: openjdk:${{ matrix.java }}
  25. options: --user root
  26. if: |
  27. !contains(github.event.head_commit.message, '[ci skip]')
  28. steps:
  29. - uses: actions/cache@v2
  30. with:
  31. path: |
  32. ~/.gradle/caches
  33. ~/.gradle/wrapper
  34. key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
  35. restore-keys: |
  36. ${{ runner.os }}-gradle-
  37. # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
  38. - uses: actions/checkout@v2
  39. - uses: gradle/wrapper-validation-action@v1
  40. - name: Build with Gradle
  41. run: |
  42. ./gradlew build --stacktrace --no-daemon
  43. - name: Upload Artifacts
  44. uses: actions/upload-artifact@v2
  45. with:
  46. name: '${{ github.event.repository.name }} Build #${{ github.run_number }}'
  47. path: |
  48. **/build/libs/
  49. !build/libs/
  50. !**/*-shadow.jar
  51. !**/*-transformProduction([\w]+).jar
  52. publish:
  53. needs: build
  54. runs-on: ubuntu-20.04
  55. container:
  56. image: openjdk:${{ matrix.java }}
  57. options: --user root
  58. if: |
  59. !contains(github.event.head_commit.message, '[norelease]') && github.event.inputs.norelease != 'true'
  60. steps:
  61. - uses: actions/cache@v2
  62. with:
  63. path: |
  64. ~/.gradle/caches
  65. ~/.gradle/wrapper
  66. key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
  67. restore-keys: |
  68. ${{ runner.os }}-gradle-
  69. # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
  70. - uses: actions/checkout@v2
  71. - name: Release to Maven and CurseForge
  72. env:
  73. # currently unused, may want to use these for changelogs though!
  74. # GIT_COMMIT: ${{ github.event.after }}
  75. # GIT_PREVIOUS_COMMIT: ${{ github.event.before }}
  76. MAVEN_PASS: ${{ secrets.MAVEN_PASS }}
  77. CURSE_API_KEY: ${{ secrets.CURSE_API_KEY }}
  78. # TODO: make this use the artifacts from the previous build step
  79. run: |
  80. ./gradlew build publish curseforgePublish --stacktrace --no-daemon