release-candidate.yml 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. name: Release candidate
  2. on:
  3. push:
  4. branches: release
  5. jobs:
  6. prepare-release:
  7. name: Prepare release candidate Pull Request
  8. runs-on: ubuntu-latest
  9. steps:
  10. - name: Checkout sources
  11. uses: actions/checkout@v2
  12. with:
  13. branch: release
  14. - name: Rebase
  15. run: |
  16. git fetch origin HEAD --depth=1
  17. git config --global user.email "actions@github.com"
  18. git config --global user.name "GitHub Actions"
  19. git rebase FETCH_HEAD
  20. - name: Cache npm dependencies
  21. id: cache-npm-libraries
  22. uses: actions/cache@v2
  23. with:
  24. path: .yarn/cache/*
  25. key: ${{ runner.os }}
  26. - name: Install Node.js
  27. uses: actions/setup-node@v2
  28. with:
  29. node-version: 16.x
  30. - name: Install dependencies
  31. run: corepack yarn install
  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-build/release update-changelogs releases.json | xargs git add
  36. - name: Update contributors table
  37. run: corepack yarn contributors:save && git add README.md
  38. - name: Update CDN URLs
  39. run: corepack yarn workspace @uppy-build/release update-version-URLs | xargs git add
  40. - name: Stage changes and remove temp files
  41. run: |
  42. git rm -rf .yarn/versions
  43. git rm CHANGELOG.next.md
  44. jq -r 'map(.cwd) | join("\n")' < releases.json | awk '{ print "git add " $0 "/package.json" }' | sh
  45. - name: Commit
  46. run: |
  47. echo "Release: uppy@$(jq -r 'map(select(.ident == "uppy"))[0].newVersion' < releases.json)" > commitMessage
  48. echo >> commitMessage
  49. echo "This is a release candidate for the following packages:" >> commitMessage
  50. echo >> commitMessage
  51. jq -r 'map("- `"+.ident+"`: "+.oldVersion+" -> "+.newVersion) | join("\n") ' < releases.json >> commitMessage
  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="$(gh api /repos/${{ github.repository }} | jq -r .default_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 }}