Closed patrickmead closed 3 years ago
You're right in that the Heroku Cli should be installed by default. Could you provide your buildlog and workflow file if possible?
Thank you very much, @AkhileshNS
`# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
name: Dendra API CI
on: push: branches: [ main ] pull_request: branches: [ main ]
jobs: build: runs-on: ubuntu-latest container: node:10.18-jessie services: postgres: image: postgres env: POSTGRES_PASSWORD: postgres options: >- --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 ports:
- 5432:5432
strategy:
matrix:
node-version: [14.x]
steps:
# - name: setup ssh
# uses: webfactory/ssh-agent@v0.4.1
# with:
# ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Set up node.js v${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Clone Dendra Repo
uses: actions/checkout@v2
- name: Setup NPM Private Github Packages
run: |
echo "@general-galactic:registry=https://npm.pkg.github.com" > .npmrc
echo "//npm.pkg.github.com/:_authToken=${{secrets.GH_NPM_REGISTRY_TOKEN}}" >> .npmrc
echo "always-auth=true" >> .npmrc
# - name: Print working directory
# run: pwd
# - name: Print npm info
# run: cat .npmrc
# - name: Print env
# run: env
# - name: git clone a private repo
# run: git clone --depth=1 -q -b master git://github.com/general-galactic/hapi-swagger.git ./crap && ls ./crap
# - name: npm install from a private github repo
# run: npm i git://github.com/general-galactic/hapi-swagger && ls node_modules/hapi-swagger
# - name: npm install private github package
# run: npm i @general-galactic/dendra-jwt && ls node_modules/@general-galactic/dendra-jwt
# - name: verify ssh key works
# run: ssh -T git@github.com
# - name: Authenticate to Github Package Registry for private NPM modules
# run: echo "//npm.pkg.github.com/:_authToken=${{secrets.GH_NPM_REGISTRY_TOKEN}}" >> .npmrc
- name: Install Dendra API Dependencies
# Skiping post-install scripts here, as a malicious script could steal NODE_AUTH_TOKEN.
# running bcrypt separately since it requires a post-install script
run: npm ci
- name: Install hapi-swagger
run: npm i git://github.com/general-galactic/hapi-swagger
- name: Lint Dendra API
run: npm run lint:ci
- name: Run Tests
env:
DATABASE_URL: postgres://postgres:postgres@postgres:5432/dendra-test # the github postgres container chose all the defaults.
run: npm test
- name: Deploy to Heroku
uses: akhileshns/heroku-deploy@v3.10.9
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: "dendra-api-stage"
heroku_email: "patrick@generalgalactic.io"
justlogin: true
remote_branch: main
- name: Notify Slack Failure
if: failure()
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
uses: voxmedia/github-action-slack-notify-build@v1
with:
channel: build-updates
status: Dendra API Build Failed
color: danger
- name: Notify Slack Success
if: success()
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
uses: voxmedia/github-action-slack-notify-build@v1
with:
channel: build-updates
status: SUCCESS
color: good
`
This is the portion of the build output for the deploy. I can post the rest of the output if this isn't sufficient.
I'm new to GitHub Actions but I have experience with Jenkins and Travis. Perhaps I'm missing something obvious.
Thanks again.
`##[debug]Evaluating condition for step: 'Deploy to Heroku'
Run akhileshns/heroku-deploy@v3.10.9 with: heroku_api_key: ** heroku_app_name: dendra-api-stage heroku_email: patrick@generalgalactic.io justlogin: true remote_branch: main branch: HEAD dontuseforce: false dontautocreate: false usedocker: false docker_heroku_process_type: web delay: 0 rollbackonhealthcheckfailed: false /usr/bin/docker exec d224d0edefcad3d011012710e18d99607e0374004dc00290bba841bf1aa1937a sh -c "cat /etc/release | grep ^ID"
Created and wrote to ~/.netrc /bin/sh: 1: heroku: not found Error: Error: Command failed: heroku login /bin/sh: 1: heroku: not found
I think it might have something to do with you using container: node:10.18-jessie
. It's possible that it's because the node: 10.18-jessie
image doesn't have heroku installed by default unlike the default ones used in github actions. Can you try adding the following step before the heroku deploy step and see if this works:
- name: Install Heroku Cli
run: curl https://cli-assets.heroku.com/install-ubuntu.sh | sh
@AkhileshNS That was it!
My last build ran with login only so I'm actually trying to deploy now.
I truly appreciate your quick reply and the assistance. Thanks again.
I’m trying to use heroku-deploy. My build fails because heroku is not found. My understanding is that the heroku-cli is preinstalled.
I uninstalled heroku-cli then installed heroku globally via npm. That didn’t work. Then I tried adding heroku to my package.json. That didn’t work.
Any suggestions are greatly appreciated. Thank you.