Git Product home page Git Product logo

Comments (7)

AngelOnFira avatar AngelOnFira commented on June 14, 2024

@ZinatSayyad what is the path you're using for the directory of the env file?

from create-envfile.

ZinatSayyad avatar ZinatSayyad commented on June 14, 2024

@ZinatSayyad what is the path you're using for the directory of the env file?

name: devlopment-deployment

Controls when the workflow will run

on:

Triggers the workflow on push or pull request events but only for the dev branch

push:
branches: [development,master]
pull_request:
branches: [development,master]

Allows you to run this workflow manually from the Actions tab

workflow_dispatch:
inputs:
brand:
description: 'Define brand name'
required: true
country:
description: 'Define brand Country'
required: true
locale:
description: 'Define brand locale'
required: true
default: 'default'

A workflow run is made up of one or more jobs that can run sequentially or in parallel

jobs:
printInputs:
runs-on: ubuntu-latest
steps:
- run: |
echo "Brand: ${{ github.event.inputs.brand }}"
echo "Branch: ${{ github.event.inputs.locale }}"

This workflow contains a single job called "build"

build:
# The type of runner that the job will run on
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set env to staging
if: endsWith(github.ref, '/development')
run: |
echo "ENVIRONMENT=stage" >> $GITHUB_ENV
echo "S3_BUCKET=${{ secrets.AWS_S3_BUCKET_STAGE}}" >> $GITHUB_ENV
echo "CONFIG_URL=${{ secrets.AWS_STAGE_CONFIG_URL }}/${{ github.event.inputs.brand }}/${{ github.event.inputs.locale }}/brand.config.json" >> $GITHUB_ENV
echo "$GITHUB_CONTEXT"

  - name: Set env to production
    if: endsWith(github.ref, '/master')
    run: |
      echo "ENVIRONMENT=prod" >> $GITHUB_ENV
      echo "S3_BUCKET=${{  secrets.AWS_S3_BUCKET_PROD }}" >> $GITHUB_ENV
      echo "CONFIG_URL=${{ secrets.AWS_STAGE_CONFIG_URL }}/${{ github.event.inputs.brand }}/${{ github.event.inputs.locale }}/brand.config.json" >> $GITHUB_ENV


  - name: Make envfile
    uses: SpicyPizza/[email protected]
    with:
      envkey_DEBUG: false 
      envkey_NODE_ENV: ${{secrets.NODE_ENV}}
      envkey_AWS_USERPOOLID: ${{ secrets[format('AWS_USERPOOLID_{0}_{1}', github.event.inputs.brand, github.event.inputs.country)] }}
      envkey_AWS_CLIENTID: ${{ secrets[format('AWS_CLIENTID_{0}_{1}', github.event.inputs.brand, github.event.inputs.country)] }}
      envkey_AWS_REGION: ${{secrets.AWS_REGION}}
      envkey_USER_PROFILE_STORE_API_URL: ${{secrets.USER_PROFILE_STORE_API_URL}}
      envkey_OPTIN_API_URL: ${{secrets.OPTIN_API_URL}}
      envkey_X_API_KEY: ${{ secrets[format('X_API_KEY_{0}_{1}', github.event.inputs.brand, github.event.inputs.country)] }}
      file_name: .env

  - name: Show files
    run: |
      ls -a
      ls -a ./packages
      ls -a ./packages/widget-template

  - name: yarn install
    run: yarn install

  - name: Run linting
    run: yarn lint

  - name: Clear dist folder
    run: rm -rf /home/runner/work/login-widget/login-widget/packages/widget-template/dist/

  - name: Run build
    run: yarn build

  - name: Show files
    run: |
      ls -a
      ls -a ./packages
      ls -a ./packages/widget-template/dist
      ls -a ./packages/widget-template/dist/ul-login

  - name: Publish artifacts
    uses: actions/upload-artifact@v2
    with:
      name: dist
      path: /home/runner/work/login-widget/login-widget/packages/widget-template/dist/ul-login/*

  - uses: aws-actions/configure-aws-credentials@v1
    with:
      aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
      aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
      aws-region: ${{ secrets.AWS_REGION }}
  - run: aws s3 rm s3://$S3_BUCKET/${{ github.event.inputs.brand }}/${{ github.event.inputs.locale }} --recursive
  - run: aws s3 sync /home/runner/work/login-widget/login-widget/packages/widget-template/dist/ul-login/ s3://$S3_BUCKET/${{github.event.inputs.brand }}/${{github.event.inputs.locale }} --delete

this is my yml file

from create-envfile.

ZinatSayyad avatar ZinatSayyad commented on June 14, 2024

@AngelOnFira there are two different error I am facing ,For build that is triggered automatically when we push the code on git showing this error
image
and the build that I triggered manually is showing this error
image

from create-envfile.

AngelOnFira avatar AngelOnFira commented on June 14, 2024

So the absolute path error should only occur if the directory environment variable starts with a slash /.

if directory == "":
    full_path = os.path.join(path, file_name)
elif directory.startswith("/"):
    # Throw an error saying that absolute paths are not allowed. This is because
    # we're in a Docker container, and an absolute path would lead us out of the
    # mounted directory.
    raise Exception("Absolute paths are not allowed. Please use a relative path.")

I'm unsure why it would be failing for you, since it seems that you aren't setting that variable. Can you verify that the environment variable INPUT_DIRECTORY isn't being set by something else?

As for the second problem, that error is occurring because your AWS_CLIENTID is an empty string. In #42 we are discussing a flag to allow this, maybe check that out too?

from create-envfile.

mfisco avatar mfisco commented on June 14, 2024

I was having the same issue when I upgraded from v1.2 to v1.3.1 and was able to get it working by simply changing the directory path like so:

       ...
      - name: Create .env file
        uses: SpicyPizza/[email protected]
        with:
          ...
        # directory: ${{ github.workspace }}/src    # <---- Worked with v1.2, but not v1.3.1
          directory: src                            # <---- Works with v1.3.1

from create-envfile.

Wadprog avatar Wadprog commented on June 14, 2024

Has anyone encountered a solution for this issue?

from create-envfile.

AngelOnFira avatar AngelOnFira commented on June 14, 2024

We might be able to do absolute paths now that we're no longer in the container. I might look back into this.

from create-envfile.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.