-
-
Save steffencrespo/829d0900f3314acffe462f2e552dd3f6 to your computer and use it in GitHub Desktop.
1-In the github repo on Settings > Integration & Services, enable | |
2-Go to travisCI page and enable the repo | |
3-Configure the env variables on TravisCI so that it is not necessary to save credentials on github | |
-in the project Settings on TravisCI, add the entry for netlify site id: NETLIFY_SITE_ID - <site_id from .netlify file generated on netlify create> | |
-create a netlify access token for TravisCI | |
-On Netlify Dashboard, Go to Account Settings > OAuth Applications (https://app.netlify.com/account/applications) > Personal access tokens and press New Access Token | |
-Name it anything, but to make it easier the suggestion is name TravisCI. | |
-Generate it and COPY it - you won’t see it again! | |
-in the project Settings on TravisCI, add the entry for netlify personal access token generated for TravisCI: NETLIFY_ACCESS_TOKEN | |
4-Generate a .travis.yml file in the local repo | |
-create a .travis.yml file in the root of the local repo with the following content: | |
language: node_js | |
node_js: node | |
cache: | |
directories: | |
- node_modules | |
script: | |
- npm test | |
env: | |
- CI=true | |
before_deploy: | |
- npm install netlify-cli -g | |
- npm run build | |
deploy: | |
provider: script | |
script: netlify deploy -s $NETLIFY_SITE_ID -t $NETLIFY_ACCESS_TOKEN -p ./build | |
skip_cleanup: true | |
on: | |
branch: master |
Followed this. But I see my development structure (Not minified) in the hosted site.
This travis config(.yml) was working some months ago but not today for me.
If anyone has errors like Error: Unexpected arguments: -t
or Error: Unexpected argument: ./build
change deploy
script
...from: script: netlify deploy -s $NETLIFY_SITE_ID -t $NETLIFY_ACCESS_TOKEN -p ./build
...to: script: netlify deploy -s $NETLIFY_SITE_ID --auth $NETLIFY_ACCESS_TOKEN -p --dir ./build
Thanks @antekai and @steffencrespo 👍🏿!
Does anyone else ever think about how awesome the internet is? Random strangers helping each other out, saving hours (and maybe years?) of our life. A great time to be alive!
Thanks @antekai, help a lot XD
New to netlify, but it looks like you can't do this with personal access tokens anymore, the new way is using the auth token which can be found in ~/.netlify/config.json
after running the netlify-cli
command directly in the repo on your local machine. After you have that token swap it out for the personal access token in your deploy command like this.
script: netlify deploy -s $NETLIFY_SITE_ID -a $NETLIFY_AUTH_TOKEN -p -d ./dist
Thank you ! 🍻