release-beta-candidate.yml 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. name: Release beta candidate
  2. on:
  3. push:
  4. branches: release-beta
  5. env:
  6. BETA_BRANCH: 3.x
  7. jobs:
  8. prepare-release:
  9. name: Prepare release candidate Pull Request
  10. runs-on: ubuntu-latest
  11. steps:
  12. - name: Checkout sources
  13. uses: actions/checkout@v3
  14. with:
  15. branch: release
  16. - name: Rebase
  17. run: |
  18. git fetch origin ${{ env.BETA_BRANCH }} --depth=1
  19. git config --global user.email "actions@github.com"
  20. git config --global user.name "GitHub Actions"
  21. git rebase FETCH_HEAD
  22. - name: Get yarn cache directory path
  23. id: yarn-cache-dir-path
  24. run: echo "::set-output name=dir::$(corepack yarn config get cacheFolder)"
  25. - uses: actions/cache@v3
  26. id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  27. with:
  28. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  29. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  30. restore-keys: |
  31. ${{ runner.os }}-yarn-
  32. - name: Install Node.js
  33. uses: actions/setup-node@v3
  34. with:
  35. node-version: lts/*
  36. - name: Install dependencies
  37. run: corepack yarn install --immutable
  38. - name: Bump candidate packages version
  39. run: corepack yarn version apply --all --json | jq -s > releases.json
  40. - name: Prepare changelog
  41. run: corepack yarn workspace @uppy-dev/release update-changelogs releases.json | xargs git add
  42. - name: Update CDN URLs
  43. run: corepack yarn workspace @uppy-dev/release update-version-URLs | xargs git add
  44. - name: Stage changes and remove temp files
  45. run: |
  46. git rm -rf .yarn/versions
  47. git rm CHANGELOG.next.md
  48. jq -r 'map(.cwd) | join("\n")' < releases.json | awk '{ print "git add " $0 "/package.json" }' | sh
  49. - name: Commit
  50. run: |
  51. echo "Release: uppy@$(jq -r 'map(select(.ident == "uppy"))[0].newVersion' < releases.json)" > commitMessage
  52. echo >> commitMessage
  53. echo "This is a release candidate for the following packages:" >> commitMessage
  54. echo >> commitMessage
  55. jq -r 'map("- `"+.ident+"`: "+.oldVersion+" -> "+.newVersion) | join("\n") ' < releases.json >> commitMessage
  56. git commit -n --amend --file commitMessage
  57. - name: Open Pull Request
  58. id: pr_opening
  59. run: |
  60. git push origin HEAD:release-candidate
  61. gh api repos/${{ github.repository }}/pulls \
  62. -F base="${{ env.BETA_BRANCH }}" \
  63. -F head="release-candidate" \
  64. -F title="$(head -1 commitMessage)" \
  65. -F body="$(git --no-pager diff HEAD^ -- CHANGELOG.md | awk '{ if( substr($0,0,1) == "+" && $1 != "+##" && $1 != "+Released:" && $1 != "+++" ) { print substr($0,2) } }')" \
  66. --jq '.number | tostring | "##[set-output name=pr_number;]"+.'
  67. env:
  68. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  69. - name: Assign to the releaser
  70. run: echo '{"assignees":[${{ toJSON(github.actor) }}]}' | gh api repos/${{ github.repository }}/issues/${{ steps.pr_opening.outputs.pr_number }}/assignees --input -
  71. env:
  72. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  73. - name: Enable Release workflow
  74. run: gh workflow enable Release --repo ${{ github.repository }}
  75. env:
  76. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}