You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

release.yml 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. name: Release
  2. # This workflow is triggered when publishing a GitHub release
  3. on:
  4. release:
  5. types:
  6. - published
  7. env:
  8. PYTHONUNBUFFERED: 1
  9. jobs:
  10. run_release:
  11. runs-on: ubuntu-latest
  12. name: Start release process
  13. timeout-minutes: 60
  14. steps:
  15. - name: Run release action
  16. id: run_release
  17. uses: SonarSource/gh-action_release/main@v3
  18. with:
  19. distribute: true
  20. publish_to_binaries: true
  21. attach_artifacts_to_github_release: true
  22. run_rules_cov: false
  23. slack_channel: sonarqube-build
  24. env:
  25. ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }}
  26. BURGRX_USER: ${{ secrets.BURGRX_USER }}
  27. BURGRX_PASSWORD: ${{ secrets.BURGRX_PASSWORD }}
  28. CIRRUS_TOKEN: ${{ secrets.CIRRUS_TOKEN }}
  29. PATH_PREFIX: ${{ secrets.BINARIES_PATH_PREFIX }}
  30. GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
  31. RELEASE_SSH_USER: ${{ secrets.RELEASE_SSH_USER }}
  32. RELEASE_SSH_KEY: ${{ secrets.RELEASE_SSH_KEY }}
  33. SLACK_API_TOKEN: ${{secrets.SLACK_API_TOKEN }}
  34. - name: Log outputs
  35. if: always()
  36. run: |
  37. echo "${{ steps.run_release.outputs.releasability }}"
  38. echo "${{ steps.run_release.outputs.release }}"
  39. echo "${{ steps.run_release.outputs.distribute_release }}"
  40. - name: Notify success on Slack
  41. uses: Ilshidur/action-slack@2.0.0
  42. env:
  43. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
  44. with:
  45. args: "Release successful for {{ GITHUB_REPOSITORY }} by {{ GITHUB_ACTOR }}"
  46. - name: Create Release for Docker Image
  47. id: create_release
  48. uses: softprops/action-gh-release@v1
  49. env:
  50. GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
  51. GITHUB_REPOSITORY: SonarSource/sonar-scanner-cli-docker
  52. with:
  53. tag_name: ${{ github.event.release.tag_name }}
  54. body: Release containing ScannerCLI version ${{ github.event.release.tag_name }}
  55. draft: false
  56. prerelease: false
  57. - name: Notify failures on Slack
  58. uses: Ilshidur/action-slack@2.0.0
  59. if: failure()
  60. env:
  61. SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
  62. with:
  63. args: "Release failed, see the logs at https://github.com/{{ GITHUB_REPOSITORY }}/actions by {{ GITHUB_ACTOR }}"
  64. maven-central-sync:
  65. runs-on: ubuntu-latest
  66. needs:
  67. - run_release
  68. steps:
  69. - name: Setup JFrog CLI
  70. uses: jfrog/setup-jfrog-cli@v1
  71. - name: JFrog config
  72. run: jfrog rt config repox --url https://repox.jfrog.io/artifactory/ --apikey $ARTIFACTORY_API_KEY --basic-auth-only
  73. env:
  74. ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }}
  75. - name: Get the version
  76. id: get_version
  77. run: |
  78. IFS=. read major minor patch build <<< "${{ github.event.release.tag_name }}"
  79. echo ::set-output name=build::"${build}"
  80. - name: Create local repository directory
  81. id: local_repo
  82. run: echo ::set-output name=dir::"$(mktemp -d repo.XXXXXXXX)"
  83. - name: Download Artifacts
  84. uses: SonarSource/gh-action_release/download-build@v3
  85. with:
  86. build-number: ${{ steps.get_version.outputs.build }}
  87. local-repo-dir: ${{ steps.local_repo.outputs.dir }}
  88. - name: Maven Central Sync
  89. id: maven-central-sync
  90. continue-on-error: true
  91. uses: SonarSource/gh-action_release/maven-central-sync@v3
  92. with:
  93. local-repo-dir: ${{ steps.local_repo.outputs.dir }}
  94. env:
  95. OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
  96. OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
  97. - name: Notify on failure
  98. if: ${{ failure() || steps.maven-central-sync.outcome == 'failure' }}
  99. uses: 8398a7/action-slack@v3
  100. with:
  101. status: failure
  102. fields: repo,author,eventName
  103. env:
  104. SLACK_WEBHOOK_URL: ${{ secrets.SLACK_BUILD_WEBHOOK }}