Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: environment deploys would be cool! #3

Open
PascaleBeier opened this issue Aug 15, 2021 · 2 comments
Open

Suggestion: environment deploys would be cool! #3

PascaleBeier opened this issue Aug 15, 2021 · 2 comments

Comments

@PascaleBeier
Copy link

PascaleBeier commented Aug 15, 2021

Hey,

thanks for that nice little action. Love it.

In my current workflow, I need to create a .env file and manually call ~/.deta/bin/deta update -e .env
to propagate current environment variables to a deployed micro.

It's not that big of a deal, but maybe this action could ease that up.

Suggestion

Add a deta-update-env flag:

deta-update-env is a path to a .env file, that does nothing more than running deta update -e with the given parameter as argument. (See https://docs.deta.sh/docs/micros/env_vars/)

I would suggest that you'd have to explicitly enable it by passing a string.

name: Deploy to Deta
on: push

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: BogDAAAMN/[email protected]
        with:
          deta-update-env: '.env' # Optional: environment file to be deployed to Deta. Defaults to '', which disables this. See https://docs.deta.sh/docs/micros/env_vars/

If you like me to, I can figure out a PR as well.

@bogdaaamn
Copy link
Owner

Helloo @PascaleBeier! Great suggestion, I have a few repos that would benefit of that as well.

I am just thinking is it a common use case to push .env files to GitHub so they can be pushed to Deta? I do use deta update -e, but all the .env files contain secret keys and tokens that I always store locally. What do you think?

@PascaleBeier
Copy link
Author

PascaleBeier commented Aug 17, 2021

Hey @bogdaaamn - sorry that I wasn't more clear, I'm really bad at describing things. You are correct, and this is my use case.

  • My applications use environment variables
  • My applications don't version control any .env files
  • My applications expect environment variables to present after deployment

So what I currently do to get my environment variables into the micro:

  - uses: BogDAAAMN/[email protected]
    name: Deploy to Deta
    with:
        deta-access-token: ${{ secrets.DETA_ACCESS_TOKEN }}
        deta-name: ${{ secrets.DETA_MICRO }}
    
  - name: Set environment variables
    run: # script to set environment variables ...

  - name: Create .env file
    run: # script to create .env file from above environment variables ...

  - name: Deploy environment variables
    run: |
      export DETA_ACCESS_TOKEN=${{ secrets.DETA_ACCESS_TOKEN }}
      ~/.deta/bin/deta update -e .env

So I would love for this action to provide a shortcut around that, given that the action user has some environment variables set he wants to propagate to the micro.

EDIT:

I put together a small Repository to illustrate.
Environment Variables might be produced during build time, or might be preset in the build environment. it has the exact Github Workflow running on https://wymc9q.deta.dev/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants