primer / deploy Goto Github PK
View Code? Open in Web Editor NEWDeploy to Now from GitHub Actions with useful aliases
Home Page: https://npm.im/@primer/deploy
License: MIT License
Deploy to Now from GitHub Actions with useful aliases
Home Page: https://npm.im/@primer/deploy
License: MIT License
We've been having issues with the Now CLI timing out, and it looks like there are a couple of fixes:
scale
numbers so that Now doesn't have to verify instantiation of as many instances in different regions.now --no-verify
the first time to skip the instantiation check.Unfortunately we can't test this with args = ["--", "--no-verify"]
because now alias
barfs on the --no-verify
flag.
You can see in this run and this log that the action is failing with:
deploy error: Error: Unable to get deployment URL from now:
I noticed in the log of the previous successful run that it was running @primer/[email protected]
, so I pinned it with primer/[email protected]
and that worked.
So the question is, what changed between 2.0.0 and 2.2.0 that would cause this? /cc @emplums
A lot has changed with Now's GitHub integration since we made this action, and it does all of the things we do. As we migrate our repos from Now v1 to v2, we need to also remove this action from our workflows and add them to the list in our installed app settings. Here's the playbook for migrating:
uses = "primer/deploy@..."
in .github/main.workflow
, and remove that action's name from any needs = [...]
prerequisites in other actions.That should be it! If all goes well, you'll get a comment from now[bot]
with a link to the deployment. If the repo you're updating is on Now v2 (if it has version: 2
in now.json
), you'll get an alias URL for the most recent deployment in the form {project}-git-{branch}.primer.now.sh
. โจ
Note that migration URLs are still available in the status checks list for each push, but the integration uses our Deployments API and closes #7.
On 3/19/19, a new version of Now was released which unfortunately deprecates the alias
subcommand.
Instead they have replaced it with a simpler but less powerful feature called "Automatic Aliasing".
https://zeit.co/blog/automatic-aliasing
That said, I do not see any mention of the POST aliases endpoint being deprecated from the v2 API. ๐ค
https://zeit.co/docs/api/#endpoints/aliases/assign-an-alias-to-a-deployment
I'm wondering if this action will need to be updated?
Currently we run the Now CLI with npx now <args>
, which presents some issues:
now
as a (dev) dependency, and may use a version that are "incompatible" with the assumptions we make here.npx
has to install now
at runtime it'll fail because it's running as root, which prevents lifecycle hooks like postinstall
from running, and it looks to me from that error that now
relies on those.So instead of running npx now
, we should have now
as a dependency in this repo and get its CLI path locally, i.e. ./node_modules/.bin/now
.
The only downside to this is that repos can't spec their own Now CLI version, but being able to upgrade it consistently across our repos by pinning a version of this action feels more sustainable to me.
Is it possible to use this action to deploy to Now V2?
Deployments would allow us to move links for the deployed site out of status checks and into the area above the PR merge box:
Based on my brief skimming, it looks like we would create a deployment with the API from this action and base the "environment" on branch (maybe development
for "root" deployments and branch aliases, staging
for release candidates, and production
on master?), let GitHub sort out the required status checks, then we'd be on the hook for running something that gets the deployment
event, actually does the deployment (running now
), then reports back status.
I think that we can respond to the deployment
event in Actions, which would mean that maybe we have a on = "deployment"
workflow that runs a different action than the one that creates the deployment, in which case we wouldn't have to run a server that gets the webhooks? I dunno, the more I write about it the less convinced I am that this is worth doing. ๐ค
/cc @jonrohan
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.