Skip to content

This action make a deployment with github actions instead of ZEIT Now builder.

License

Notifications You must be signed in to change notification settings

amondnet/now-deployment

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace
This branch is 77 commits ahead of, 6 commits behind iam4x/now-deploy-preview-comment:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

c3080c6 · Apr 4, 2020
Feb 25, 2020
Feb 18, 2020
Apr 4, 2020
Oct 17, 2019
Feb 25, 2020
Feb 18, 2020
Oct 16, 2019
Apr 4, 2020
Mar 16, 2020
Feb 18, 2020
Apr 4, 2020
Feb 25, 2020
Oct 17, 2019
Oct 17, 2019
Apr 4, 2020
Apr 4, 2020
Aug 26, 2019

Repository files navigation

ZEIT Now Deployment

ZEIT Now is a cloud platform for static sites and Serverless Functions

This action make a ZEIT Now deployment with github actions.

  • Deploy to ZEIT now.
  • Comment on pull request.
  • Comment on commit.
  • Create Deployment on github.

Result

preview

pull request example

commit

Inputs

Name Required Default Description
zeit-token [x] ZEIT now token.
zeit-team-id [ ] if your deployment is made on team project and github-comment is true. example: team_asdf1234
github-comment [ ] true if you don't want to comment on pull request.
github-token [ ] if you want to comment on pull request.
now-args [ ] This is optional args for now cli. Example: --prod
working-directory [ ] the working directory
now-project-id [x] ❗️Now CLI 17+,The name property in now.json is deprecated (https://zeit.ink/5F)
now-org-id [x] ❗️Now CLI 17+,The name property in now.json is deprecated (https://zeit.ink/5F)

Outputs

preview-url

The url of deployment preview.

Example Usage

Disable ZEIT Now for GitHub

The ZEIT Now for GitHub integration automatically deploys your GitHub projects with ZEIT Now, providing Preview Deployment URLs, and automatic Custom Domain updates. link

We would like to to use github actions for build and deploy instead of ZEIT Now.

Set github.enabled: false in now.json

{
  "version": 2,
  "public": false,
  "github": {
    "enabled": false
  },
  "builds": [
    { "src": "./public/**", "use": "@now/static" }
  ],
  "routes": [
    { "src": "/(.*)", "dest": "public/$1" }
  ]
}

When set to false, ZEIT Now for GitHub will not deploy the given project regardless of the GitHub app being installed.

now.json Example:

{
  "name": "zeit-now-deployment",
  "version": 2,
  "scope": "amond",
  "public": false,
  "github": {
    "enabled": false
  },
  "builds": [
    { "src": "./public/**", "use": "@now/static" }
  ],
  "routes": [
    { "src": "/(.*)", "dest": "public/$1" }
  ]
}

Project Linking

You should link a project via Now CLI in locally.

When running now in a directory for the first time, Now CLI needs to know which scope and Project you want to deploy your directory to. You can choose to either link an existing project or to create a new one.

NOTE: Project linking requires at least version 17 of Now CLI. If you have an earlier version, please update to the latest version.

now
? Set up and deploy “~/web/my-lovely-project”? [Y/n] y
? Which scope do you want to deploy to? My Awesome Team
? Link to existing project? [y/N] y
? What’s the name of your existing project? my-lovely-project
🔗 Linked to awesome-team/my-lovely-project (created .now and added it to .gitignore)

Once set up, a new .now directory will be added to your directory. The .now directory contains both the organization(now-org-id) and project(now-project-id) id of your project.

{"orgId":"example_org_id","projectId":"example_project_id"}

You can save both values in the secrets setting in your repository. Read the Official documentation if you want further info on how secrets work on Github.

Github Actions

  • This is a complete .github/workflow/deploy.yml example.

Set the now-project-id and now-org-id you found above.

name: deploy website
on: [pull_request]
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: amondnet/now-deployment@v2
        with:
          zeit-token: ${{ secrets.ZEIT_TOKEN }} # Required
          github-token: ${{ secrets.GITHUB_TOKEN }} #Optional 
          zeit-team-id: team_XXXXXXXXXXX #Optional 
          now-args: '--prod' #Optional
          now-org-id: ${{ secrets.ORG_ID}}  #Required
          now-project-id: ${{ secrets.PROJECT_ID}} #Required 
          working-directory: ./sub-directory

Agnular Example

See .github/workflow/example-angular.yml ,

About

This action make a deployment with github actions instead of ZEIT Now builder.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 54.0%
  • TypeScript 37.7%
  • HTML 7.9%
  • CSS 0.4%