我正在尝试使用 github 操作通过 bash 将文件部署到外部端点。
此文件位于操作所在目录的上两个目录中。在本地,我可以使用路径
../../src/indexer/templates/library.json
到达它。我尝试过使用工作区作为根,但该文件从未实际设置为 json
变量。当前步骤:
- name: Deploy template to cluster
run: |
json="<${{GITHUB_WORKSPACE}}/src/indexer/templates/library.json"
echo "deploying template to cluster ${{ inputs.environment }}"
curl -X PUT \
-H 'Content-Type: application/json' \
-u "${{ steps.secrets.outputs.USERNAME }}:${{ steps.secrets.outputs.PASSWORD }}" \
-d '$json' \
"${{ secrets.CLUSTER_URL }}";
我这里缺少一些语法吗,或者有更好的方法在单独的步骤中执行此操作吗?
在运行命令之前尝试使用
working-directory
关键字更改到目录
https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
- name: Clean temp directory
run: rm -rf *
working-directory: ./temp