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

Not working with Bun Sveltekit app in CI #348

Open
paulGeoghegan opened this issue Jul 1, 2024 · 0 comments
Open

Not working with Bun Sveltekit app in CI #348

paulGeoghegan opened this issue Jul 1, 2024 · 0 comments

Comments

@paulGeoghegan
Copy link

Overview:

I have been trying to use dotenv-vault in my Sveltekit app that uses Bun for a few days now. The app is deployed to Digital Ocean using a GitHub workflow. I need to access the .env file in the workflow because I can't build the app without it but I can't seem to get it to work.

Steps to reproduce:

  • Create a Sveltekit app using bun that uses env variables,
  • Store the env variables in dotenv-vault,
  • try to deploy the app using a GitHub workflow

Workflow File:

name: Build and Deploy SvelteKit App

on:
push:
  branches:
    - main
workflow_dispatch:

jobs:
build:
  runs-on: ubuntu-latest
  steps:
    - uses: actions/checkout@v3
    - name: Setup Bun
      uses: oven-sh/setup-bun@v1
      with:
        bun-version: latest # Use the latest stable Bun release
    - name: Install dependencies
      run: bun install
    - name: Build the project
      env:
        DOTENV_KEY: ${{ secrets.DOTENV_KEY }}
      run: bun run build
    - uses: actions/upload-artifact@v3
      with:
        name: build
        path: build

deploy:
  runs-on: ubuntu-latest
  needs: build
  steps:
    - uses: actions/download-artifact@v3
      with:
        name: build
        path: build
    - name: Deploy to DigitalOcean Droplet
      uses: appleboy/ssh-action@master
      with:
        host: ${{ secrets.HOST }}
        username: ${{ secrets.USERNAME }}
        key: ${{ secrets.KEY }}
        script: |
          cd /home/deployer/Take-the-Cake-Website
          rm -rf build   # Clean up old build to avoid conflicts
          scp -r build/* ${{ secrets.USERNAME }}@${{ secrets.HOST }}:/home/deployer/Take-the-Cake-Website
          pm2 reload Take-the-Cake-Website
          echo 'Deployment to Digital Ocean finished'

What I have tried:

  • I have tried modifying the package.json file to incorporate the suggestions from the docs about using dotenv-vault with sveltekit but bun does not have a -r option and the bun require command doesn't work as a replacement.
  • I have used the decrypt command to validate that everything is working and it does print the env variables in the workflow.
  • Using the pull command doesn't work since it requires you to login using the website.
    Thanks for reading and let me know if you need any more information.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant