release.yml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. name: Release
  2. on:
  3. push:
  4. tags:
  5. - "389-ds-base-*"
  6. workflow_dispatch:
  7. inputs:
  8. version:
  9. description: Specify tag to generate a tarball
  10. required: true
  11. skip-audit-ci:
  12. description: Skip npx --yes audit-ci
  13. type: boolean
  14. default: false
  15. permissions:
  16. actions: read
  17. packages: read
  18. contents: write
  19. jobs:
  20. build:
  21. runs-on: ubuntu-latest
  22. container:
  23. image: quay.io/389ds/ci-images:test
  24. steps:
  25. - name: Get the version
  26. id: get_version
  27. run: |
  28. echo "version=${VERSION}" >> $GITHUB_OUTPUT
  29. env:
  30. VERSION: ${{ github.event.inputs.version || github.ref_name }}
  31. - name: Checkout
  32. uses: actions/checkout@v6
  33. with:
  34. fetch-depth: 0
  35. ref: ${{ steps.get_version.outputs.version }}
  36. - name: Check if the tagged commit belongs to a valid branch
  37. run: |
  38. git config --global --add safe.directory "$GITHUB_WORKSPACE"
  39. COMMIT=$(git rev-parse HEAD)
  40. BRANCHES=$(git branch -a --contains $COMMIT | grep -v 'HEAD detached at')
  41. if [ -n "$BRANCHES" ]; then
  42. echo "Tagged commit $COMMIT belongs to the following branch(es):"
  43. echo "$BRANCHES"
  44. else
  45. echo "Tagged commit $COMMIT does not belong to any branch."
  46. exit 1
  47. fi
  48. - name: Create tarball
  49. run: |
  50. git config --global --add safe.directory "$GITHUB_WORKSPACE"
  51. if [ "${{ github.event.inputs.skip-audit-ci }}" = "true" ]; then
  52. export SKIP_AUDIT_CI=1
  53. fi
  54. TAG=${{ steps.get_version.outputs.version }} make -f rpm.mk dist-bz2
  55. - name: Upload tarball
  56. uses: actions/upload-artifact@v7
  57. with:
  58. name: ${{ steps.get_version.outputs.version }}.tar.bz2
  59. path: ${{ steps.get_version.outputs.version }}.tar.bz2
  60. - name: Release
  61. uses: softprops/action-gh-release@v2
  62. with:
  63. tag_name: ${{ steps.get_version.outputs.version }}
  64. files: |
  65. ${{ steps.get_version.outputs.version }}.tar.bz2