GitHub 针对 Google App Engine 的操作(可交付成果)

GitHub Action for Google App Engine (deliverables)

我正在尝试设置一个 GitHub 操作,以便在我推送到 master 分支时自动部署到 Google App Engine。但是,我在管道中很新。我试着做作业,但最后还是被困住了。

首先,这是我的 .github/workflows/main.yml:

name: Deployment

on:
  push:
    branches:
    - master
  
jobs:
  deploy:
    name: Deploy to App Engine
    runs-on: ubuntu-latest
    steps:
      - name: Google App Engine
        uses: google-github-actions/deploy-appengine@v0.4.0
        with:
          project_id: my-gae-project-id
          version: master
          credentials: ${{secrets.GOOGLE_APP_ENGINE_KEY}}
          flags: --no-cache
          deliverables: app.yaml

现在我尝试在根目录和 .github/workflows 目录中创建 app.yaml。 None 其中有效。现在,我的 app.yaml 只是:

runtime: php74
env: standard

这是我每次 GH 操作的结果:

我试着做了一些研究,发现建议将 app.yaml 放在一个文件夹中,所以我也尝试了 .github/workflows/gae/app.yaml 然后将其设置为 deliverables: gae/app.yaml - 没有成功。还尝试将路径放在 deliverables: "gae/app.yaml" 之类的引号中 - 没有成功。还尝试将 app.yaml 放入根目录并将其设置为 deliverables: ../../app.yaml。在某些情况下,app.yaml 会创建一个新的 GitHub 操作,这更令人恼火。

现在我很沮丧,因为我知道这会很愚蠢,但我没有找到很多关于这个具体案例的资源。

您的 main.yml 中缺少一个步骤,这就是您的工作流程无法找到和访问文件的原因。要修复它,请在您的步骤中添加 checkout@v2 操作:

name: Deployment

on:
  push:
    branches:
    - master
  
jobs:
  deploy:
    name: Deploy to App Engine
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Google App Engine
        uses: google-github-actions/deploy-appengine@v0.4.0
        with:
          project_id: my-gae-project-id
          version: master
          credentials: ${{secrets.GOOGLE_APP_ENGINE_KEY}}
          flags: --no-cache
          deliverables: app.yaml

您也可以访问这个官方github example供您参考。