release.yml 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. name: Create release with tag
  2. on:
  3. push:
  4. # Sequence of patterns matched against refs/heads
  5. branches:
  6. - '*.*.*' # Push events to matching ex:20.15.10
  7. env:
  8. TAG_VALUE: ${GITHUB_REF/refs\/heads\//}
  9. PR_BRANCH: release-ci-${{ github.sha }}
  10. jobs:
  11. generate-changelog:
  12. name: Generate Changelog
  13. runs-on: ubuntu-latest
  14. steps:
  15. - name: Checkout code
  16. uses: actions/checkout@v2
  17. - name: 🏷️ Create/update tag
  18. uses: actions/github-script@v7
  19. with:
  20. script: |
  21. github.rest.git.createRef({
  22. owner: context.repo.owner,
  23. repo: context.repo.repo,
  24. ref: 'refs/tags/${{ github.ref_name }}',
  25. sha: context.sha
  26. }).catch(err => {
  27. if (err.status !== 422) throw err;
  28. })
  29. - name: Update CHANGELOG
  30. id: changelog
  31. uses: requarks/changelog-action@v1
  32. with:
  33. token: ${{ github.token }}
  34. tag: ${{ github.ref_name }}
  35. writeToFile: true
  36. #excludeTypes: build,docs,style
  37. #includeInvalidCommits: true
  38. - name: Commit CHANGELOG.md
  39. uses: stefanzweifel/git-auto-commit-action@v4
  40. with:
  41. branch: master
  42. commit_message: 'docs: update CHANGELOG.md for ${{ github.ref_name }} [skip ci]'
  43. file_pattern: CHANGELOG.md
  44. build:
  45. name: Upload Release Asset
  46. permissions: write-all
  47. runs-on: ubuntu-latest
  48. steps:
  49. - name: Checkout code
  50. uses: actions/checkout@v2
  51. - name: Build project # This would actually build your project, using zip for an example artifact
  52. id: build_
  53. env:
  54. GITHUB_NAME: ${{ github.event.repository.name }}
  55. run: sudo apt-get install libxml-xpath-perl;echo $(xpath -e '/root/versions/version[num="'${GITHUB_REF/refs\/heads\/v/}'"]/compatibility/text()' plugin.xml);echo ::set-output name=version_glpi::$(xpath -e '/root/versions/version[num="'${GITHUB_REF/refs\/heads\/v/}'"]/compatibility/text()' plugin.xml); rm -rf plugin.xml tools wiki screenshots test .git .github ISSUE_TEMPLATE.md TODO.txt $GITHUB_NAME.png;cd ..; tar jcvf $GITHUB_NAME-${GITHUB_REF/refs\/heads\//}.tar.bz2 $GITHUB_NAME;ls -al;echo ::set-output name=tag::${GITHUB_REF/refs\/heads\//};echo ${{ steps.getxml.outputs.info }};
  56. # run: rm -rf plugin.xml tools wiki screenshots test ISSUE_TEMPLATE.md TODO.txt $GITHUB_NAME.png; tar -zcvf $GITHUB_NAME-$GITHUB_TAG.tar.gz $GITHUB_NAME
  57. - name: Create Release
  58. id: create_release
  59. uses: actions/create-release@v1
  60. env:
  61. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  62. with:
  63. tag_name: ${{ steps.build_.outputs.tag }}
  64. release_name: |
  65. GLPI ${{ steps.build_.outputs.version_glpi }} : Version ${{ steps.build_.outputs.tag }} disponible / available
  66. body : Version ${{ steps.build_.outputs.tag }} released for GLPI ${{ steps.build_.outputs.version_glpi }}. The [full changelog is available](https://github.com/edgardmessias/glpi-singlesignon/blob/${{ steps.build_.outputs.tag }}/CHANGELOG.md) for more details.
  67. draft: false
  68. prerelease: false
  69. - name: Upload Release Asset
  70. id: upload-release-asset
  71. uses: actions/upload-release-asset@v1
  72. env:
  73. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  74. GITHUB_NAME: ${{ github.event.repository.name }}
  75. with:
  76. upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
  77. asset_path: /home/runner/work/${{ github.event.repository.name }}/${{ github.event.repository.name }}-${{ steps.build_.outputs.tag }}.tar.bz2
  78. asset_name: ${{ github.event.repository.name }}-${{ steps.build_.outputs.tag }}.tar.bz2
  79. asset_content_type: application/zip