Hi developers!
I need to add the env.json to my app without committing to git. I use the github action from athom athombv/github-action-homey-app-publish. Anyone did this and got the env.json added to the app? Tried adding a step that creates the file:
- name: ‘Create env file’
id: create-json
uses: jsdaniell/create-json@v1.2.3
with:
name: “env.json”
json: ‘{ “TEST” = “1” }’
But it is not collaborating. What do I miss?
Is env.json in your gitignore file?
Yes. I could remove it from gitignore and remove the file locally. But will that make the github action pick up the env.json that is created in the step before?
Because it is when publishing from local machine.
Actually what I want is to feed som environment variables / secrets to the app.
Ah, sorry I misunderstood, I thought you meant it was being added to Github.
I only publish from the CLI, so env.json is only local.
@philipostli I did this once for another project:
- name: Create .env file
uses: ozaytsev86/create-env-file@v1
with:
ENV_SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
ENV_SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
In this case it’s a .env file. But maybe you can make it work for a env.json (looks like it’s possible)
The secrets are set in the repository/organization
Thank you. I will add secrets eventually. First I need to include a test variable from a env.json file created in the pipeline. I tried creating it manually:
- name: 'Create env file'
run: |
touch env.json
echo TEST="1" >> env.json
cat env.json
also without the athombv/github-action-homey-app-publish action, like I would do locally:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 20
- name: Install dependencies
run: npm ci --ignore-scripts --audit=false
- name: Publish app
run: HOMEY_HEADLESS="1" HOMEY_PAT="${{ secrets.HOMEY_PAT }}" npx homey app publish