Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
cloud

GitHub Action

Netlify CLI

1.0.1

Netlify CLI

cloud

Netlify CLI

Fast Netlify CLI wrapper with output

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Netlify CLI

uses: South-Paw/action-netlify-cli@1.0.1

Learn more about this action in South-Paw/action-netlify-cli

Choose a version

action-netlify-cli

This action enables arbitrary actions with the Netlify CLI

This action is a replacement for netlify/actions/cli@master without the docker layer that incurs an extra 30-50s of runner time (which seems result in an average deploy time of ~1m 30s).

This action usually completes in under a minute (and in best cases, 30s).

Secrets

Outputs

The following outputs will be available from a step that uses this action:

  • NETLIFY_OUTPUT, the full stdout from the run of the netlify command
  • NETLIFY_LOGS_URL, the URL where the logs from the deploy can be found
  • NETLIFY_DRAFT_URL, the URL of the draft site that Netlify provides
  • NETLIFY_PROD_URL, the URL of the "real" site, set only if --prod was passed

Recipes

Simple publish

on: [push]
jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      # build your site for deployment... in this case the `public` folder is being deployed

      - name: Publish
        uses: South-Paw/action-netlify-cli@v1
        id: netlify
        with:
          # be sure to escape any double quotes with a backslash and note that the --json
          # flag has been passed when deploying - if you want the outputs to work you'll need to include it
          args: 'deploy --json --dir \"./public\" --message \"draft [${{ github.sha }}]\"'
        env:
          NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
          NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}

      # and access outputs in other steps with ${{ steps.netlify.outputs.OUTPUT_ID }}

GitHub deployments

on: [push]
jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - name: Start deployment
        uses: bobheadxi/deployments@v1
        id: deployment
        with:
          env: production
          step: start

      # ... steps to build your site for deployment

      - name: Deploy to Netlify
        uses: South-Paw/action-netlify-cli@v1
        id: netlify
        with:
          args: deploy --json --prod --dir './public' --message 'production [${{ github.sha }}]'
        env:
          NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
          NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}

      - name: Finish deployment
        uses: bobheadxi/deployments@v1
        if: always()
        with:
          env: ${{ steps.deployment.outputs.env }}
          step: finish
          status: ${{ job.status }}
          deployment_id: ${{ steps.deployment.outputs.deployment_id }}
          env_url: ${{ steps.netlify.outputs.NETLIFY_PROD_URL }}

Issues and Bugs

If you find any, please report them here so they can be squashed.

License

MIT, see the LICENSE file.