Search code examples
google-app-enginegithubcontinuous-integrationgithub-actions

GitHub Action for Google App Engine (deliverables)


I am trying to set up a GitHub action to automatically deploy to Google App Engine when I push to the master branch. However, I am quite new in the pipelines. I tried to do my homework and I ended up stuck with this.

First, this is my .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/[email protected]
        with:
          project_id: my-gae-project-id
          version: master
          credentials: ${{secrets.GOOGLE_APP_ENGINE_KEY}}
          flags: --no-cache
          deliverables: app.yaml

Now I tried to create the app.yaml in the root directory and also in the .github/workflows directory. None of them works. For now, my app.yaml is just:

runtime: php74
env: standard

Here is the outcome of my GH action everytime:

github screenshot

I tried to do some research and found recommendation to put the app.yaml in a folder, so I also tried .github/workflows/gae/app.yaml and then set it as deliverables: gae/app.yaml - no success. Also tried to put the path in quotes like deliverables: "gae/app.yaml" - no success. Also tried to put the app.yaml to the root and set it as deliverables: ../../app.yaml. In some cases, the app.yaml creates a new GitHub action which is even more irritating.

Now I'm just getting frustrated, because I know this is going to be something silly, but I didn't find many resources about this specific case.


Solution

  • There is a missing step in your main.yml that's why your workflow can't find and access the files. To fix it, add checkout@v2 action in your steps:

    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/[email protected]
            with:
              project_id: my-gae-project-id
              version: master
              credentials: ${{secrets.GOOGLE_APP_ENGINE_KEY}}
              flags: --no-cache
              deliverables: app.yaml
    

    You can also visit this official github example for your reference.