I'm having the following circleCi config :
version: 2
jobs:
build:
machine: true
branches:
ignore: gh-pages
steps:
- run: echo "Skipping tests on gh-pages branch"
deployment:
machine:
node:
version: 6.11.2
npm:
version: 3.10.10
branch: ci
steps:
- run: git config --global user.email "<GITHUB_USERNAME>#users.noreply.github.com"
- run: git config --global user.name "<YOUR_NAME>"
- run: echo "machine github.com login <GITHUB_USERNAME> password $GITHUB_TOKEN" > ~/.netrc
- run: cd website && npm install && GIT_USER=<GIT_USER> npm run publish-gh-pages
that aims to deploy a https://docusaurus.io/ site on my github page.
Actually, when the CI runs on the ci branch, it should run the deployment job.
Actually, the deployment job is never triggered and I don't understand why.
I'm well building my ci branch
Here's my circleci build :
This is not running correctly because the config you are using is completely incorrect. There's aspects of CircleCI 2.0 configuration and aspects of CircleCI 1.0 configuration.
I'd recommend choosing one platform (CircleCI 2.0) and then going through the configuration reference for that version. Here's the configuration reference for CircleCI 2.0: https://circleci.com/docs/2.0/configuration-reference/
Feel free to do that, come back and update your question, or post a question at https://discuss.circleci.com.
Respectfully,
Ricardo N Feliciano
Developer Evangelist, CircleCI
Related
My CI/CD is: git > cicleci > heroku
I'm using circleci's suggested configuration (attached below)
I have the proper environment variable in circleci.
The first part is working well, however, when I deploy to heroku I can see warnings from devs dependencies like:
./src/hooks/myHook.js
Line 11: React Hook useEffect has a missing dependency: 'x'. Either include it or remove the dependency array react-hooks/exhaustive-deps
which makes me think that React dev is running.
Can anyone help me?
version: 2
jobs:
build:
...
deploy:
docker:
- image: buildpack-deps:trusty
steps:
- checkout
- run:
name: Deploy Master to Heroku
command: |
git push https://heroku:$HEROKU_API_KEY#git.heroku.com/$HEROKU_APP_NAME.git master
workflows:
version: 2
build-deploy:
jobs:
- build
- deploy:
requires:
- build
filters:
branches:
only: master
I'm not sure if you are already but I highly recommend using this Heroku buildpack rather than the standard Heroku Node buildpack: https://github.com/mars/create-react-app-buildpack. This buildpack starts in production by default.
In Heroku go to settings > Buildpacks and click on the Add buildpack, then enter the following url: https://github.com/mars/create-react-app-buildpack.git and save.
However if there is a hook error as above I would fix that issue by adding it into the dependency array in the hook.
I'm setting up my Travis Ci integration with my GitHub pages repo and I'm getting this error when committing to my dev branch, which on completion should automatically commit to my master branch.
My Error:
gh-token is invalid. Details: GET https://api.github.com/user: 401 - Bad credentials // See: https://developer.github.com/v3
My git flow is as follows:
I use dev as an intermediary branch. The application is using vue.js and required a production build, which the production build is what should be pushed to master.
push local branch to remote branch
create a pull request on remote feature branch to the dev branch
merge feature branch with dev branch (this is when Travis CI should push to master)
Here is my current .travis.yml
if: branch = dev
language: node_js
node_js:
- "lts/*"
cache:
directories:
- "node_modules"
script:
- set -e
- npm run build
deploy:
provider: pages
skip_cleanup: true
github_token: GITHUB_TOKEN
keep_history: true
local_dir: build
target_branch: master
on:
branch: dev
I've confirmed my GitHub access token and tried increasing permissions. The token I'm currently using only has public repo access, which is based on the Travis CI docs
Might be an easy fix.
Have you tried access GITHUB_TOKEN like an environment variable?
github_token: $GITHUB_TOKEN
I'm trying to set up a workflow in CircleCI for my React project.
What I want to achieve is to get a job to build the stuff and another one to deploy the master branch to Firebase hosting.
This is what I have so far after several configurations:
witmy: &witmy
docker:
- image: circleci/node:7.10
version: 2
jobs:
build:
<<: *witmy
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
- v1-dependencies-
- run: yarn install
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
- run:
name: Build app in production mode
command: |
yarn build
- persist_to_workspace:
root: .
deploy:
<<: *witmy
steps:
- attach_workspace:
at: .
- run:
name: Deploy Master to Firebase
command: ./node_modules/.bin/firebase deploy --token=MY_TOKEN
workflows:
version: 2
build-and-deploy:
jobs:
- build
- deploy:
requires:
- build
filters:
branches:
only: master
The build job always success, but with the deploy I have this error:
#!/bin/bash -eo pipefail
./node_modules/.bin/firebase deploy --token=MYTOKEN
/bin/bash: ./node_modules/.bin/firebase: No such file or directory
Exited with code 1
So, what I understand is that the deploy job is not running in the same place the build was, right?
I'm not sure how to fix that. I've read some examples they provide and tried several things, but it doesn't work. I've also read the documentation but I think it's not very clear how to configure everything... maybe I'm too dumb.
I hope you guys can help me out on this one.
Cheers!!
EDITED TO ADD MY CURRENT CONFIG USING WORKSPACES
I've added Workspaces... but still I'm not able to get it working, after a loooot of tries I'm getting this error:
Persisting to Workspace
The specified paths did not match any files in /home/circleci/project
And also it's a real pain to commit and push to CircleCI every single change to the config file when I want to test it... :/
Thanks!
disclaimer: I'm a CircleCI Developer Advocate
Each job is its own running Docker container (or VM). So the problem here is that nothing in node_modules exists in your deploy job. There's 2 ways to solve this:
Install Firebase and anything else you might need, on the fly, just like you do in the build job.
Utilize CircleCI Workspaces to carry over your node_modules directory from the build job to the deploy job.
In my opinion, option 2 is likely your best bet because it's more efficient.
I am trying to get Travis-CI to automatically deploy a successful tagged build to Heroku. Below is my .travis.yml setup:
deploy:
provider: heroku
strategy: git
run:
- "rake db:migrate"
- restart
on:
tags: true
Upon tagging the repository:
git tag -a 1.0.0 -m "release 1.0.0"
and pushing to the remote repository, Travis-CI kicks off the build but exits immediately after the following:
$ git fetch --tags
Done. Your build exited with 0.
Travis-CI does not deploy the application to Heroku. Am I missing a piece?
There is currently a glitch with on: tags: true that the condition is never met and the code will never trigger a deploy. The github issue is here. The issue should be resolved soon, and in the meantime you can use a branch like releases to update your heroku app with on:branch.
Update:
To fix on:tags, you can do this, as refrenced in the above github issue.
on:
tags: true
all_branches: true
I'm trying to configure CoinsManager so that the alpha version gets auto-deployed after Travis Continuous Integration.
Here is our .travis.yml file:
language: node_js
node_js:
- '0.10'
before_install:
- make install
services:
- mongodb
deploy:
provider: heroku
app: coinsmanager
api_key:
secure: "FjcbJdgcB1IIug3Qf5oFlF5PHW8LYnIUJCSUEz7GI5i6tVvtye1UvqkA12BP+//u3rtPcO3d33rjNY5/qvIRIdJ/wMKACAHdzRa8jWge2dxW7filynF6LVsh5ezwr7Sq/MgNwvqQcRp7eQNsOlBzdZRyQYE0VAa4fAD1+SZPnWQ="
on:
all_branches: true
after_deploy:
- "cd app/client/compass && compass compile && cd -"
- "cd app/ && meteor reset"
- restart
The problem is Travis reporting the following error:
Expected(200) <=> Actual(401 Unauthorized)
body: "{\"id\":\"unauthorized\",\"error\":\"Invalid credentials provided.\"}" (wrong API key?)
failed to deploy
But I did exactly like the doc recommended
$ travis encrypt $(heroku auth:token) --add deploy.api_key
I also tried slighly different cases (with or without dash an double quotes), as suggested in that Github issue.
I'm not sure where the problem comes from: Travis? Heroku?
I solved my problem.
We have the upstream repo at CoinsManager/CoinsManager, which I forked at Fandekasp/CoinsManager. And when running travis encrypt, travis is getting the repo name from my origin remote, instead of querying the heroku git repo.
Therefore, I needed to specify the correct repo as follow:
$ travis encrypt -r CoinsManager/CoinsManager $(heroku auth:token) --add deploy.api_key