release-beta-candidate.yml 3.3 KB

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