当我通过我的 bitbucket 存储库推送到 master 时,我想将我的应用程序部署到 HEROKU。我的bitbucket-pipeline.yml
文件设置似乎没有任何语法错误。
但是在阅读我的$HEROKU_API_KEY
. 此密钥在我的.env
文件中,并在我从文件中记录它时记录到控制台index.js
。
唯一可行的选择是将其复制api-key
并粘贴到该行中。但我真的不想那样做。
我目前Ubuntu 18.04 LTS
在node v10.16.3
我该如何解决这个难题?
这是yml文件
# This is a sample build configuration for JavaScript.
# Check our guides at https://confluence.atlassian.com/x/14UWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: node:10.15.3
pipelines:
default:
- step:
name: Defaults
caches:
- node
script: # Modify the commands below to build your repository.
- npm install
- npm test
- step:
name: create artifact
script:
- mkdir artefacts
- tar -czf artefacts/my-app-$BITBUCKET_BUILD_NUMBER.tar.gz --exclude=./artefacts .
- cp artefacts/* .
artifacts:
- my-app-*.tar.gz
- step:
name: Deploy to production
deployment: production
script:
- pipe: atlassian/heroku-deploy:1.0.1
variables:
HEROKU_API_KEY: $HEROKU_API_KEY
HEROKU_APP_NAME: "my-app"
ZIP_FILE: "my-app-$BITBUCKET_BUILD_NUMBER.tar.gz"
WAIT: "true" # Optional.
DEBUG: "false" # Optional