Open AngelOnFira opened 2 years ago
@ZinatSayyad what is the path you're using for the directory of the env file?
@ZinatSayyad what is the path you're using for the directory of the env file?
name: devlopment-deployment
on:
push: branches: [development,master] pull_request: branches: [development,master]
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'
jobs: printInputs: runs-on: ubuntu-latest steps:
run: | echo "Brand: ${{ github.event.inputs.brand }}" echo "Branch: ${{ github.event.inputs.locale }}"
build:
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/create-envfile@v1.3 with: envkey_DEBUG: false envkey_NODE_ENV: ${{secrets.NODE_ENV}} envkey_AWS_USERPOOLID: ${{ secrets[format('AWSUSERPOOLID{0}_{1}', github.event.inputs.brand, github.event.inputs.country)] }} envkey_AWS_CLIENTID: ${{ secrets[format('AWSCLIENTID{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_APIKEY{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
@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 and the build that I triggered manually is showing this error
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?
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/create-envfile@v1.3.1
with:
...
# directory: ${{ github.workspace }}/src # <---- Worked with v1.2, but not v1.3.1
directory: src # <---- Works with v1.3.1
Has anyone encountered a solution for this issue?
We might be able to do absolute paths now that we're no longer in the container. I might look back into this.
I am facing issue while creating .env file Traceback (most recent call last): File "/opt/action/create-envfile.py", line 38, in
raise Exception("Absolute paths are not allowed. Please use a relative path.")
Exception: Absolute paths are not allowed. Please use a relative path. Please help to resolvee the issue @AngelOnFira
Originally posted by @ZinatSayyad in https://github.com/SpicyPizza/create-envfile/issues/10#issuecomment-1041457301