release.yml 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. # GitHub Actions Workflow created for handling the release process based on the draft release prepared
  2. # with the Build workflow. Running the publishPlugin task requires the PUBLISH_TOKEN secret provided.
  3. name: Release
  4. on:
  5. release:
  6. types: [released]
  7. jobs:
  8. # Prepare and publish the plugin to the Marketplace repository
  9. # release:
  10. # name: Publish Plugin
  11. # runs-on: ubuntu-latest
  12. # steps:
  13. #
  14. # - name: Setup Java
  15. # uses: actions/setup-java@v3
  16. # with:
  17. # java-version: 11
  18. # distribution: 'zulu'
  19. #
  20. # - name: Fetch Sources
  21. # uses: actions/checkout@v4
  22. # with:
  23. # ref: ${{ github.event.release.tag_name }}
  24. #
  25. # - name: Publish Plugin
  26. # env:
  27. # PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
  28. # run: ./gradlew publishPlugin
  29. build:
  30. name: Build
  31. runs-on: ubuntu-latest
  32. steps:
  33. - name: Setup Java
  34. uses: actions/setup-java@v3
  35. with:
  36. java-version: 11
  37. distribution: 'zulu'
  38. - name: Fetch Sources
  39. uses: actions/checkout@v4
  40. - name: Setup Gradle Dependencies Cache
  41. uses: actions/cache@v4.0.0
  42. with:
  43. path: ~/.gradle/caches
  44. key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts') }}
  45. - name: Setup Gradle Wrapper Cache
  46. uses: actions/cache@v4.0.0
  47. with:
  48. path: ~/.gradle/wrapper
  49. key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
  50. - name: Set environment variables
  51. id: properties
  52. shell: bash
  53. run: |
  54. PROPERTIES="$(./gradlew properties --console=plain -q)"
  55. VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
  56. NAME="$(echo "$PROPERTIES" | grep "^pluginName_:" | cut -f2- -d ' ')"
  57. ARTIFACT="${NAME}-${VERSION}.zip"
  58. echo "::set-output name=version::$VERSION"
  59. echo "::set-output name=name::$NAME"
  60. echo "::set-output name=artifact::$ARTIFACT"
  61. - name: Build Plugin
  62. run: ./gradlew buildPlugin
  63. - name: Upload Release Asset
  64. id: upload-release-asset
  65. uses: actions/upload-release-asset@v1
  66. env:
  67. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  68. with:
  69. upload_url: ${{ github.event.release.upload_url }}
  70. asset_path: ./build/distributions/${{ steps.properties.outputs.artifact }}
  71. asset_name: ${{ steps.properties.outputs.artifact }}
  72. asset_content_type: application/zip