Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

meta: add release automations #3304

Merged
merged 33 commits into from Dec 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
d0eb26b
meta: add release automations
aduh95 Nov 5, 2021
2af4a68
Add missing versions
aduh95 Nov 5, 2021
973756c
remove old scripts that are no longer useful
aduh95 Nov 5, 2021
93eff7e
add special casing for robodog
aduh95 Nov 6, 2021
d0e29f3
skip fetching if HEAD is already available locally
aduh95 Nov 6, 2021
8b762ea
Publish to npm from GitHub actions
aduh95 Nov 7, 2021
bde78ca
fixes
aduh95 Nov 7, 2021
a69d222
Update afterVersionBump script
aduh95 Nov 9, 2021
3897c3c
Fix getUpToDateRefsFromGitHub script
aduh95 Nov 9, 2021
959f3fb
Make sub-package specific changelogs
aduh95 Nov 9, 2021
91d06a8
fix git and PR opening process in GH Actions
aduh95 Nov 10, 2021
7346639
fix Release action
aduh95 Nov 10, 2021
dd1b227
don't fetch GH user names in changelog
aduh95 Nov 11, 2021
e600def
add support for commits that touch several packages
aduh95 Nov 11, 2021
3a8d3b3
add website as a valid commit message prefix
aduh95 Nov 13, 2021
4506f8b
Assign the PR to the releaser and fix other GH related bugs
aduh95 Nov 13, 2021
c08e529
Remove release branch from CI
aduh95 Nov 14, 2021
73f672e
Restore git history at the end of local release session
aduh95 Nov 14, 2021
0024a1d
skip CI if assignee has not approved the PR
aduh95 Nov 14, 2021
bf5251e
fix release commit message
aduh95 Nov 14, 2021
36cd4d9
beautify commit message
aduh95 Nov 14, 2021
3cd67c4
Special case for @uppy/robodog
aduh95 Nov 14, 2021
f7b8419
Failure is not an option
aduh95 Nov 14, 2021
c328487
Rename release CI
aduh95 Nov 14, 2021
9ad0727
Always rewind before crashing
aduh95 Nov 14, 2021
b4383ce
Improve logging
aduh95 Nov 14, 2021
b926ece
fix changelog table
aduh95 Nov 14, 2021
258995a
fix linter
aduh95 Nov 14, 2021
3b4e045
Update CONTRIBUTING.md
aduh95 Nov 14, 2021
c80c4d1
Remove unused package
aduh95 Nov 14, 2021
bdb47b1
Disable Release workflow between two releases
aduh95 Nov 22, 2021
bef44d5
Fix conflicts
aduh95 Nov 22, 2021
819f69d
Fix git command and workaround deleted branch
aduh95 Nov 22, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.js
Expand Up @@ -176,6 +176,7 @@ module.exports = {
'.eslintrc.js',
'website/*.js',
'website/**/*.js',
'private/**/*.js',
],
rules: {
'no-console': 'off',
Expand Down
31 changes: 11 additions & 20 deletions .github/CONTRIBUTING.md
Expand Up @@ -143,26 +143,17 @@ yarn install
yarn start
```

Releases are managed by [Lerna](https://github.com/lerna/lerna). We do some cleanup and compile work around releases too. Use the npm release script:

```bash
yarn run release
```

If you have two-factor authentication enabled on your account, Lerna will ask for a one-time password. You may stumble upon a known issue with the CLI where the OTP prompt may be obscured by a publishing progress bar. If Lerna appears to freeze as it starts publishing, chances are it’s waiting for the password. Try typing in your OTP and hitting enter.

Other things to keep in mind during release:

* When adding a new package, add the following key to its package.json:
```json
"publishConfig": { "access": "public" }
```
Else, the release script will try and fail to publish a _private_ package, because the `@uppy` scope on npm does not support that.

After a release, the demos on transloadit.com should also be updated. After updating, check that some things work locally:

* the demos in the demo section work (try one that uses an import robot, and one that you need to upload to)
* the demos on the homepage work and can import from Google Drive, Instagram, Dropbox, etc.
Releases are managed by GitHub Actions, here’s an overview of the process to release a new Uppy version:

* Run `yarn release` on your local machine.
* Follow the instructions and select what packages to release.
* Before committing, check if the generated files look good.
* Push to the Transloadit repository using the command given by the tool. Do not open a PR yourself, the GitHub Actions will create one and assign you to it.
* Wait for all the GitHub Actions checks to pass. If one fails, try to figure out why. Do not go ahead without consulting the rest of the team.
* Review the PR thoroughly, and if everything looks good to you, approve the PR. Do not merge it manually!
* After the PR is automatically merged, the demos on transloadit.com should also be updated. Check that some things work locally:
* the demos in the demo section work (try one that uses an import robot, and one that you need to upload to)
* the demos on the homepage work and can import from Google Drive, Instagram, Dropbox, etc.

If you don’t have access to the transloadit.com source code ping @arturi or @goto-bus-stop and we’ll pick it up. :sparkles:

Expand Down
42 changes: 0 additions & 42 deletions .github/workflows/cdn.yml

This file was deleted.

73 changes: 73 additions & 0 deletions .github/workflows/release-candidate.yml
@@ -0,0 +1,73 @@
name: Release candidate
on:
push:
branches: release

jobs:
prepare-release:
name: Prepare release candidate Pull Request
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
with:
branch: release
- name: Rebase
run: |
git fetch origin HEAD --depth=1
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"
git rebase FETCH_HEAD
- name: Cache npm dependencies
id: cache-npm-libraries
uses: actions/cache@v2
with:
path: .yarn/cache/*
key: ${{ runner.os }}
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: 16.x
- name: Install dependencies
run: corepack yarn install
- name: Bump candidate packages version
run: corepack yarn version apply --all --json | jq -s > releases.json
- name: Prepare changelog
run: corepack yarn workspace @uppy-build/release update-changelogs releases.json | xargs git add
- name: Update contributors table
run: corepack yarn contributors:save && git add README.md
- name: Update CDN URLs
run: corepack yarn workspace @uppy-build/release update-version-URLs | xargs git add
- name: Stage changes and remove temp files
run: |
git rm -rf .yarn/versions
git rm CHANGELOG.next.md
jq -r 'map(.cwd) | join("\n")' < releases.json | awk '{ print "git add " $0 "/package.json" }' | sh
- name: Commit
run: |
echo "Release: uppy@$(jq -r 'map(select(.ident == "uppy"))[0].newVersion' < releases.json)" > commitMessage
echo >> commitMessage
echo "This is a release candidate for the following packages:" >> commitMessage
echo >> commitMessage
jq -r 'map("- `"+.ident+"`: "+.oldVersion+" -> "+.newVersion) | join("\n") ' < releases.json >> commitMessage
git commit -n --amend --file commitMessage
- name: Open Pull Request
id: pr_opening
run: |
git push origin HEAD:release-candidate
gh api repos/${{ github.repository }}/pulls \
-F base="$(gh api /repos/${{ github.repository }} | jq -r .default_branch)" \
-F head="release-candidate" \
-F title="$(head -1 commitMessage)" \
-F body="$(git --no-pager diff HEAD^ -- CHANGELOG.md | awk '{ if( substr($0,0,1) == "+" && $1 != "+##" && $1 != "+Released:" && $1 != "+++" ) { print substr($0,2) } }')" \
--jq '.number | tostring | "##[set-output name=pr_number;]"+.'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Assign to the releaser
run: echo '{"assignees":[${{ toJSON(github.actor) }}]}' | gh api repos/${{ github.repository }}/issues/${{ steps.pr_opening.outputs.pr_number }}/assignees --input -
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Enable Release workflow
run: gh workflow enable Release --repo ${{ github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91 changes: 91 additions & 0 deletions .github/workflows/release.yml
@@ -0,0 +1,91 @@
name: Release
on:
pull_request_review:
types: [submitted]

jobs:
release:
name: Publish releases
if: ${{ github.event.review.state == 'approved' && github.event.sender.login == github.event.pull_request.assignee.login && github.event.pull_request.head.ref == 'release-candidate' }}
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Cache npm dependencies
id: cache-npm-libraries
uses: actions/cache@v2
with:
path: .yarn/cache/*
key: ${{ runner.os }}
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: 16.x
- name: Install dependencies
run: corepack yarn install
- name: Get CHANGELOG diff
run: git --no-pager diff HEAD^ -- CHANGELOG.md | awk '{ if( substr($0,0,1) == "+" && $1 != "+##" && $1 != "+Released:" && $1 != "+++" ) { print substr($0,2) } }' > CHANGELOG.diff.md
- name: Build before publishing
run: corepack yarn run build
- name: Publish to NPM
run: corepack yarn workspaces foreach --no-private npm publish --access public --tolerate-republish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Merge PR
id: merge
run: |
gh api -X PUT repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/merge \
-F merge_method="squash" \
-F commit_message="$(cat CHANGELOG.diff.md)" \
--jq 'if .merged then "##[set-output name=sha;]"+.sha else error("not merged") end'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create tags
run: |
git --no-pager diff --name-only HEAD^ | awk '$0 ~ /^packages\/.+\/package\.json$/ { print "jq -r '"'"'\"gh api /repos/{owner}/{repo}/git/refs -f ref=\\\"refs/tags/\"+.name+\"@\"+.version+\"\\\" -f sha=${{ steps.merge.outputs.sha }}\"'"'"' < " $0 }' > createTags.sh
cat createTags.sh
sh createTags.sh | sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get Uppy version number
id: uppyVersion
run: jq -r '"##[set-output name=version;]"+.version' < packages/uppy/package.json
- name: Create GitHub release
run: gh release create uppy@${{ steps.uppyVersion.outputs.version }} -t "Uppy ${{ steps.uppyVersion.outputs.version }}" -F CHANGELOG.diff.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload `uppy` to CDN
run: corepack yarn run uploadcdn uppy
env:
EDGLY_KEY: ${{secrets.EDGLY_KEY}}
EDGLY_SECRET: ${{secrets.EDGLY_SECRET}}
- name: Upload `@uppy/robodog` to CDN if it was released
run: git diff --exit-code --quiet HEAD^ -- packages/@uppy/robodog/package.json || corepack yarn run uploadcdn @uppy/robodog
env:
EDGLY_KEY: ${{secrets.EDGLY_KEY}}
EDGLY_SECRET: ${{secrets.EDGLY_SECRET}}
- name: Upload `@uppy/locales` to CDN if it was released
if: false
run: git diff --exit-code --quiet HEAD^ -- packages/@uppy/locales/package.json ||corepack yarn run uploadcdn @uppy/locales
env:
EDGLY_KEY: ${{secrets.EDGLY_KEY}}
EDGLY_SECRET: ${{secrets.EDGLY_SECRET}}
- name: Remove release-candidate branch
run: gh api -X DELETE repos/${{ github.repository }}/git/refs/heads/release-candidate
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Remove release branch
run: gh api -X DELETE repos/${{ github.repository }}/git/refs/heads/release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Disable Release workflow
run: gh workflow disable Release --repo ${{ github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: In case of failure
if: ${{ failure() }}
run: gh pr comment ${{ github.event.pull_request.number }} --body "Release job failed, please take action."
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
106 changes: 0 additions & 106 deletions bin/after-version-bump.js

This file was deleted.

8 changes: 0 additions & 8 deletions bin/make-changelog

This file was deleted.