heroku
CLI to interact with Heroku
VERSION
heroku/7.41.1 darwin-x64 node-v12.16.2
USAGE
$ heroku [COMMAND]COMMANDS
access manage user access to apps
addons tools and services for developing, extending, and operating
your app
apps manage apps on Heroku
auth check 2fa status
authorizations OAuth authorizations
autocomplete display autocomplete installation instructions
buildpacks scripts used to compile apps
certs a topic for the ssl plugin
ci run an application test suite on Heroku
clients OAuth clients on the platform
config environment variables of apps
container Use containers to build and deploy Heroku apps
domains custom domains for apps
drains forward logs to syslog or HTTPS
features add/remove app features
git manage local git repository for app
help display helpfor heroku
keys add/remove account ssh keys
labs add/remove experimental features
local run Heroku app locally
logs display recent log output
maintenance enable/disable access to app
members manage organization members
notifications display notifications
orgs manage organizations
pg manage postgresql databases
pipelines manage pipelines
plugins list installed plugins
ps Client tools for Heroku Exec
psql open a psql shell to the database
redis manage heroku redis instances
regions list available regions for deployment
releases display the releases for an app
reviewapps manage reviewapps in pipelines
run run a one-off process inside a Heroku dyno
sessions OAuth sessions
spaces manage heroku private spaces
status status of the Heroku platform
teams manage teams
update update the Heroku CLI
webhooks list webhooks on an app
測試 Heroku
這邊以一個簡單的 go server 作為範例,程式碼如下所示。當我們對這個 server 發起請求他會回應你 現在 server 是使用哪一個 port 跟你做溝通。
heroku login
heroku: Press any key to open up the browser to login or q to exit:
Opening browser to https://cli-auth.heroku.com/auth/cli/browser/5e83cd9d-51cc-4676-b0be-d240a1f5c480
Logging in... done...
接著設定 heroku git 把git remote url 設定好
heroku git:remote -a example-githubaction
set git remote heroku to https://git.heroku.com/example-githubaction.git
這邊我直接上github action 整合Heroku container image 後的 ci yaml給大家參考,大家也可以依照個做變化做成自己想要的樣子。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
push:name:Pushruns-on:ubuntu-lateststeps:- name:Check out code into the Go module directoryuses:actions/checkout@v2- name:Login to Heroku Container registryenv:HEROKU_API_KEY:${{ secrets.HEROKU_API_KEY }}run:heroku container:login - name:Build and pushenv:HEROKU_API_KEY:${{ secrets.HEROKU_API_KEY }}run:heroku container:push -a ${{ env.APP_NAME }} web- name:Releaseenv:HEROKU_API_KEY:${{ secrets.HEROKU_API_KEY }}run:heroku container:release -a ${{ env.APP_NAME }} web