release-beta-candidate.yml 3.2 KB

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