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

Clean up old expo builds on PR merge #84

Open
2 tasks
brettdh opened this issue Sep 5, 2018 · 0 comments
Open
2 tasks

Clean up old expo builds on PR merge #84

brettdh opened this issue Sep 5, 2018 · 0 comments

Comments

@brettdh
Copy link
Contributor

brettdh commented Sep 5, 2018

Motivation

We have a bunch of old Expo builds published from every PR since #70 landed. This doesn't seem to be a problem yet, but it could make Expo annoyed with us at some point in the future. We should really be cleaning these up as we merge each PR, so that the temporary build only lives as long as the PR.

Plan of action

  • When deploying from master, change app and storybook release channel names to master or staging (to distinguish them from PR/dev-branch deployments)
  • When CI runs on master, clean up release channels for closed PRs / deleted branches
    • Unfortunately, CircleCI seems to lack the ability to run a script in response to merging a PR, so it's tricky to get the PR number as it's being merged. We can take a brute-force approach instead, which also has the benefit of clearing out the old deployments that have already accumulated.
    • Possible algorithm:
      1. Collect the commit shas for all non-master branches in the repo; this is the list of "active" commits (those with an Expo deployment that should remain live)
      2. Use the Github API (see ci/post-expo-comment.js for an example) to identify any branches that match closed PRs; remove those shas from the active list
      3. List all Expo deployments; prune the active ones from the list
      4. Unpublish (publish:rollback) the remaining, inactive deployments.

See Expo docs for CLI details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant