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

Help - Did I set up my main.yml correctly? #156

Open
mattfranciswork0 opened this issue Nov 20, 2021 · 1 comment
Open

Help - Did I set up my main.yml correctly? #156

mattfranciswork0 opened this issue Nov 20, 2021 · 1 comment

Comments

@mattfranciswork0
Copy link

mattfranciswork0 commented Nov 20, 2021

I don't think my .scss files are being compiled to .css at the CI build time.

Here is my main.yml:

name: Deploy

on:
    push:
        branches:
            - main

jobs:
    build:
        runs-on: ubuntu-latest
        steps:
            - name: Checkout source Git branch
              uses: actions/checkout@v2
              with:
                ref: main
                fetch-depth: 10
                submodules: true
            - name: Compile CSS from SCSS files
              uses: gha-utilities/[email protected]
              with:
                source: ./src/scss/main.scss
                destination: ./src/scss/main.css
              
          #Deploys to Heroku
            - uses: actions/checkout@v2
            - uses: akhileshns/[email protected] # This is the action
              with:
                  heroku_api_key: ${{secrets.HEROKU_API_KEY}}
                  heroku_app_name: "gh-actions-heroku" #Must be unique in Heroku
                  heroku_email: "[email protected]"

Here is the github actions output that is working in step: Compile SCSS files to CSS:

        Run gha-utilities/[email protected]
    Warning: ENOENT: no such file or directory, stat './src/scss/main.css'
    Attempting to write to file path -> ./src/scss/main.css
    Wrote file -> ./src/scss/main.css

This is the error in the next step (when trying to deploy it to Heroku). It looks like main.css is not created in src/scss at the CI build time since Heroku does not recognize the file?

        remote: Failed to compile.        
    remote: remote: ./pages/_app.tsxremote: 
    Module not found: Can't resolve '../src/scss/main.css' in '/tmp/build_9673181c/pages

Here is my project directory

.github
  -> workflows
      -> main.yml
src
  pages
    -> app.ts (uses 'import "../src/scss/main.css"; in the file)
  scss 
   -> main.scss
   -> main.css (untracked in git & not pushed to remote repoistory, it is used locally
      ; github actions should compile the main.scss file and create a main.css file at CI build time)
package.json
@S0AndS0
Copy link
Member

S0AndS0 commented Dec 5, 2021

On first glance it seems the source and destination YAML configs have an unneeded ./ prefix on the target paths. Which may be why the ENOENT warning is popping...

Warning: ENOENT: no such file or directory, stat './src/scss/main.css'

Can ya please try removing the ./ prefix from source and destination YAML configs, and report if that does or does not fix things?

Example

jobs:
    build:
        runs-on: ubuntu-latest
        steps:
            - name: Checkout source Git branch
              uses: actions/checkout@v2
              with:
                ref: main
                fetch-depth: 10
                submodules: true
            - name: Compile CSS from SCSS files
              uses: gha-utilities/[email protected]
              with:
                source: src/scss/main.scss
                destination: src/scss/main.css

          #Deploys to Heroku
            - uses: actions/checkout@v2
            - uses: akhileshns/[email protected] # This is the action
              with:
                  heroku_api_key: ${{secrets.HEROKU_API_KEY}}
                  heroku_app_name: "gh-actions-heroku" #Must be unique in Heroku
                  heroku_email: "[email protected]"

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