Comments (7)
@ZinatSayyad what is the path you're using for the directory of the env file?
from create-envfile.
@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.
@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
from create-envfile.
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.
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.
Has anyone encountered a solution for this issue?
from create-envfile.
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)
- Release Version HOT 1
- Node 20
- keys' casing is being converted to uppercase
- Warning: Unexpected input(s) 'envkey_XXX' HOT 1
- Fail if secret is not defined HOT 3
- Error: docker: command not found HOT 1
- How do I create the env file in a server i have provided ssh credentials for? HOT 2
- Why directory not work? HOT 1
- Make a better way to fail an Action test HOT 1
- Empty env keys aren't backwards compatible HOT 10
- env file not being created / GITHUB_WORKSPACE not set HOT 9
- Do not mutate key name HOT 2
- How to escape multiline values in .env file HOT 6
- Container action is only supported on Linux HOT 5
- Question: What does this do to an already existing .env file present in the specified directory? HOT 2
- Sorted keys breaks variable dependence in the envfile HOT 3
- Unrecognized named-value: 'secrets'. Located at position 1 within expression:
- Unable to create .env file HOT 2
- How can I create .env file with my own custom name? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from create-envfile.