Akshat Khanna
Akshat Khanna

Reputation: 23

Github actions issues with main.yaml file to create .env file during deployment

I am trying to deploy my project using Google App engine using Github actions. I created main.yaml file and added a job to create .env file during deployment. But it is showing the built successful but the .env is not added to the code. I am using actions Create .env file.

This is my main.yaml file-

name: CI

on:
  
  push:
    branches: [ deploy ]
  pull_request:
    branches: [ deploy ]

jobs:
  create-envfile:
    runs-on: ubuntu-18.04
    steps:
      - name: Make envfile
        uses: SpicyPizza/create-envfile@v1
        with:
          envkey_DEBUG: False
          envkey_DATABASE_URL: ${{ secrets.DATABASE_URL }}
          envkey_USER: ${{ secrets.USER }}
          envkey_PASSWORD: ${{ secrets.PASSWORD }}
          envkey_DATABASE_NAME: ${{ secrets.DATABASE_NAME }}
          file_name: .env

  build:
    runs-on: ubuntu-latest

    steps:
        
      - uses: actions/checkout@v2

      - name: Initialize Google Cloud SDK
        uses: zxyle/publish-gae-action@master
        with:
          service_account_email: ${{ secrets.GCP_SA_EMAIL }}
          service_account_key: ${{ secrets.GCP_SA_KEY }}
          project_id: ${{ secrets.PROJECT_ID }}
          # An optional variables parameter can be used
          gae_variables: ${{ secrets.GAE_VARIABLES }}

      - name: Publish app to Google App Engine
        run: |
          # This client-secret.json is converted by GCP_SA_KEY.
          gcloud auth activate-service-account ${{ secrets.GCP_SA_EMAIL }} --key-file=client-secret.json
          gcloud config set project ${{ secrets.PROJECT_ID }}
          gcloud -q app deploy app.yaml --promote

This is the output of the https://github.com/khannakshat7/Elektra/actions/runs/888591866

Upvotes: 2

Views: 729

Answers (1)

VonC
VonC

Reputation: 1324937

You run shows

Unexpected input(s) 'envkey_DEBUG', 'envkey_DATABASE_URL', 'envkey_USER', 'envkey_PASSWORD', 'envkey_DATABASE_NAME', 
valid inputs are ['entryPoint', 'args', 'file_name']

As explained in SpicyPizza/create-envfile issue 10:

because Github is expecting all the potential input variables to be defined by the Action's definition.

You could ignore that warning except in your case, as commented here, it does not seem to work.
Check issue 12 for a possible .env right issue.

Here is an example which works (from issue 14):


    - name: Make envfile
      uses: SpicyPizza/create-envfile@v1
      with:
        envkey_DEBUG: false
        envkey_REACT_APP_FIREBASE_API_TOKEN: ${{ secrets.FIREBASE_API_TOKEN }}
        file_name: .env

Upvotes: 3

Related Questions