patch-release.yml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. name: Patch Release
  2. on:
  3. workflow_dispatch:
  4. inputs:
  5. branch:
  6. description: 'Branch to run the action on'
  7. required: true
  8. default: 'master'
  9. jobs:
  10. patch-release:
  11. runs-on: ubuntu-latest
  12. environment: prod
  13. steps:
  14. - name: Extract branch name
  15. shell: bash
  16. id: extract_branch
  17. run: |
  18. echo "BRANCH=${{ github.event.inputs.branch }}" >> $GITHUB_ENV
  19. echo "Branch: " $BRANCH
  20. - name: checkout patch branch
  21. uses: actions/checkout@v3
  22. with:
  23. ref: ${{ env.BRANCH }}
  24. - uses: actions/setup-node@v3
  25. with:
  26. node-version: 22
  27. cache: 'npm'
  28. registry-url: 'https://registry.npmjs.org'
  29. - name: Install dependencies
  30. run: npm install
  31. - name: Install Playwright Browsers
  32. run: npx playwright install --with-deps
  33. - name: Run tests
  34. run : |
  35. npm test
  36. - name: Get new version string
  37. id: get_new_patch_version
  38. run: |
  39. chmod +rx ./.github/workflows/scripts/new-patch-version.sh
  40. . ./.github/workflows/scripts/new-patch-version.sh
  41. shell: bash
  42. - name: See patch branch
  43. run: echo branch ${{ env.BRANCH }}
  44. shell: bash
  45. - name: See new patch version
  46. run: echo "# version:" ${{ env.VERSION }}
  47. shell: bash
  48. - name: checkout master branch
  49. uses: actions/checkout@v3
  50. with:
  51. ref: master
  52. fetch-depth: 0
  53. - name: Set Git Config
  54. run : |
  55. # Set git configs
  56. git config --global user.name "${GITHUB_ACTOR}"
  57. git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
  58. - name: Update Version on master
  59. id: update_backport_version_master
  60. run: |
  61. jq --arg ver "${{ env.VERSION }}" '.versions += [$ver]' ./documentation/versions.json >> /tmp/temp.json
  62. mv /tmp/temp.json ./documentation/versions.json
  63. git add . && git commit -m "Docs: Add ${{ env.VERSION }} to versions.json"
  64. git push
  65. - name: checkout unstable branch
  66. uses: actions/checkout@v3
  67. with:
  68. ref: unstable
  69. fetch-depth: 0
  70. - name: Update Version on unstable
  71. id: update_backport_version_unstable
  72. run: |
  73. jq --arg ver "${{ env.VERSION }}" '.versions += [$ver]' ./documentation/versions.json >> /tmp/temp.json
  74. mv /tmp/temp.json ./documentation/versions.json
  75. git add . && git commit -m "Docs: Add ${{ env.VERSION }} to versions.json"
  76. git push
  77. git checkout ${{ env.BRANCH }}
  78. - name: Set Git Config
  79. run : |
  80. # Set git configs
  81. git config --global user.name "${GITHUB_ACTOR}"
  82. git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
  83. - name: Make Release
  84. id: release
  85. run: |
  86. chmod +rx .github/workflows/scripts/pre_release_test.sh
  87. . .github/workflows/scripts/pre_release_test.sh ${{ env.BRANCH }}
  88. - name: Archive action failure results
  89. uses: actions/upload-artifact@v4
  90. if: ${{ failure() && steps.release.conclusion == 'failure' }}
  91. with:
  92. name: npm-release--failure-report
  93. path: /home/runner/.npm/_logs/
  94. - name: Publish Package To npmjs
  95. run: npm publish
  96. env:
  97. NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
  98. - name: Publish Package to GitHub Releases
  99. run: |
  100. curl -L \
  101. -X POST \
  102. -H "Accept: application/vnd.github+json" \
  103. -H "Authorization: Bearer ${{ secrets.MAIN_GH_TOKEN }}" \
  104. -H "X-GitHub-Api-Version: 2022-11-28" \
  105. https://api.github.com/repos/${{ github.repository }}/releases \
  106. -d '{"tag_name":"v${{ env.VERSION }}","target_commitish":"master","name":"v${{ env.VERSION }}","body":"Release version v${{ env.VERSION }}","draft":false,"prerelease":false,"generate_release_notes":false}'
  107. - name: Deploy to Github Pages 🚀
  108. if: ${{ env.BRANCH == 'master' }}
  109. uses: JamesIves/github-pages-deploy-action@v4
  110. with:
  111. folder: documentation