@@ -16,9 +16,6 @@ This action usually completes in under a minute (and in best cases, 30s).
1616The following outputs will be available from a step that uses this action:
1717
1818- ` NETLIFY_OUTPUT ` , the full stdout from the run of the ` netlify ` command
19- - ` NETLIFY_LOGS_URL ` , the URL where the logs from the deploy can be found
20- - ` NETLIFY_DRAFT_URL ` , the URL of the draft site that Netlify provides
21- - ` NETLIFY_PROD_URL ` , the URL of the "real" site, set only if ` --prod ` was passed
2219
2320## Recipes
2421
@@ -33,11 +30,10 @@ jobs:
3330 # build your site for deployment... in this case the `public` folder is being deployed
3431
3532 - name : Publish
36- uses : South-Paw/action-netlify-cli@1.0.1
33+ uses : South-Paw/action-netlify-cli@v2
3734 id : netlify
3835 with :
39- # be sure to escape any double quotes with a backslash and note that the --json
40- # flag has been passed when deploying - if you want the outputs to work you'll need to include it
36+ # be sure to escape any double quotes with a backslash
4137 args : ' deploy --json --dir \"./public\" --message \"draft [${{ github.sha }}]\"'
4238 env :
4339 NETLIFY_AUTH_TOKEN : ${{ secrets.NETLIFY_AUTH_TOKEN }}
6460 # ... steps to build your site for deployment
6561
6662 - name : Deploy to Netlify
67- uses : South-Paw/action-netlify-cli@1.0.1
63+ uses : South-Paw/action-netlify-cli@v2
6864 id : netlify
6965 with :
66+ # note that the --json flag has been passed so we can parse outputs
7067 args : deploy --json --prod --dir './public' --message 'production [${{ github.sha }}]'
7168 env :
7269 NETLIFY_AUTH_TOKEN : ${{ secrets.NETLIFY_AUTH_TOKEN }}
8077 step : finish
8178 status : ${{ job.status }}
8279 deployment_id : ${{ steps.deployment.outputs.deployment_id }}
83- env_url : ${{ steps.netlify.outputs.NETLIFY_PROD_URL }}
80+ env_url : ${{ fromJson(steps.netlify.outputs.NETLIFY_OUTPUT).url }}
81+ ` ` `
82+
83+ ### Parse ` --json` flag
84+
85+ ` ` ` yml
86+ on: [push]
87+ jobs:
88+ publish:
89+ runs-on: ubuntu-latest
90+ steps:
91+ # ... steps to build your site for deployment
92+
93+ - name: Deploy to Netlify
94+ uses: South-Paw/action-netlify-cli@v2
95+ id: netlify
96+ with:
97+ # note that the --json flag has been passed so we can parse outputs
98+ args: deploy --json --prod --dir './public' --message 'production [${{ github.sha }}]'
99+ env:
100+ NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
101+ NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
102+
103+ # You can parse the ` NETLIFY_OUTPUT` output with `fromJson` function for the following information:
104+ - name : Parse NETLIFY_OUTPUT JSON
105+ run : |
106+ echo "The URL where the logs from the deploy can be found"
107+ echo "${{ fromJson(steps.netlify.outputs.NETLIFY_OUTPUT).logs }}"
108+ echo ""
109+ echo "the URL of the draft site that Netlify provides"
110+ echo "${{ fromJson(steps.netlify.outputs.NETLIFY_OUTPUT).deploy_url }}"
111+ echo ""
112+ echo "the URL of the "real" site, set only if `--prod` was passed"
113+ echo "${{ fromJson(steps.netlify.outputs.NETLIFY_OUTPUT).url }}"
84114` ` `
85115
86116## Issues and Bugs
0 commit comments