File tree Expand file tree Collapse file tree 3 files changed +45
-4
lines changed Expand file tree Collapse file tree 3 files changed +45
-4
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ The inputs this action uses are:
40
40
| `functions_directory` | `false` | N/A | The (optional) directory where your Netlify functions are stored |
41
41
| `install_command` | `false` | `npm i` | The (optional) command to install dependencies |
42
42
| `build_command` | `false` | `npm run build` | The (optional) command to build static website |
43
+ | `deploy_alias` | `false` | '' | (Optional) [Deployed site alias](https://cli.netlify.com/commands/deploy) |
43
44
44
45
# # Example
45
46
91
92
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
92
93
93
94
` ` `
95
+
96
+ # ## Use branch name to deploy
97
+
98
+ Will deploy under `https://${branchName}.${siteName}.netlify.app`
99
+
100
+ ` ` ` yml
101
+ name: 'Netlify Deploy'
102
+
103
+ on:
104
+ push:
105
+ branches:
106
+ - '*'
107
+
108
+ jobs:
109
+ deploy:
110
+ name: 'Deploy'
111
+ runs-on: ubuntu-latest
112
+
113
+ steps:
114
+ - uses: actions/checkout@v1
115
+ - uses: jsmrcaga/action-netlify-deploy@master
116
+ with:
117
+ NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
118
+ NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
119
+ deploy_alias: ${{ GITHUB_REF##*/ }}
120
+ ` ` `
Original file line number Diff line number Diff line change @@ -42,6 +42,11 @@ inputs:
42
42
description : ' Command to build static website'
43
43
required : false
44
44
default : ' npm run build'
45
+
46
+ deploy_alias :
47
+ description : ' Deployment Subdomain name'
48
+ required : false
49
+ default : ' '
45
50
46
51
runs :
47
52
using : ' docker'
54
59
- ${{ inputs.functions_directory }}
55
60
- ${{ inputs.install_command }}
56
61
- ${{ inputs.build_command }}
62
+ - ${{ inputs.deploy_alias }}
57
63
58
64
branding :
59
65
icon : activity
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ BUILD_DIRECTORY=$4
9
9
FUNCTIONS_DIRECTORY=$5
10
10
INSTALL_COMMAND=$6
11
11
BUILD_COMMAND=$7
12
+ DEPLOY_ALIAS=$8
12
13
13
14
# Install dependencies
14
15
eval ${INSTALL_COMMAND:- " npm i" }
@@ -20,10 +21,17 @@ eval ${BUILD_COMMAND:-"npm run build"}
20
21
export NETLIFY_SITE_ID=$NETLIFY_SITE_ID
21
22
export NETLIFY_AUTH_TOKEN=$NETLIFY_AUTH_TOKEN
22
23
23
- # Deploy with netlify
24
+ COMMAND=" netlify deploy --dir=$BUILD_DIRECTORY --functions=$FUNCTIONS_DIRECTORY --message=\" $INPUT_NETLIFY_DEPLOY_MESSAGE \" "
25
+
24
26
if [[ $NETLIFY_DEPLOY_TO_PROD == " true" ]]
25
27
then
26
- netlify deploy --dir=$BUILD_DIRECTORY --functions=$FUNCTIONS_DIRECTORY --prod --message=" $INPUT_NETLIFY_DEPLOY_MESSAGE "
27
- else
28
- netlify deploy --dir=$BUILD_DIRECTORY --functions=$FUNCTIONS_DIRECTORY --message=" $INPUT_NETLIFY_DEPLOY_MESSAGE "
28
+ COMMAND+=" --prod"
29
29
fi
30
+
31
+ if [[ -n $DEPLOY_ALIAS ]]
32
+ then
33
+ COMMAND+=" --alias $COMMAND "
34
+ fi
35
+
36
+ # Deploy with netlify
37
+ eval $COMMAND
You can’t perform that action at this time.
0 commit comments