Build netlify in github actions

I am trying build code with netlify in github actions,

but i am not able to do it.

My repo : GitHub - elisalimli/old_airbnb-clone: Airbnb clone built with typescript,graphql,react and prisma


My netlify toml file :
`

./netlify.toml

[build]
command = “npm run build:web”
publish = “packages/web/out”

[functions]
directory = “packages/web/out_functions”

[dev]
command = “yarn start”
port = 8888
targetPort = 4321
publish = “packages/web/out”
functions = “packages/web/out_functions”
autoLaunch = true
framework = “next”

[[plugins]]
package = “@netlify/plugin-nextjs”
`

I am trying use jsmrcaga/action-netlify-deploy@master

But it gives me the following error :

`

build:netlify

126> netlify build

128

129(node:425) [EACCES] Error Plugin: netlify-cli: EACCES: permission denied, open ‘/github/home/.config/netlify/config.json’

130You don’t have access to this file.

131

132module: @oclif/config@1.17.0

133task: runHook init

134plugin: netlify-cli

135root: /github/workspace/node_modules/netlify-cli

136See more details with DEBUG=*

137(Use node --trace-warnings ... to show where the warning was created)

138 Error Plugin: netlify-cli: EACCES: permission denied, open

139 ‘/github/home/.config/netlify/config.json’

140 You don’t have access to this file.

141

142 Code: EACCES

143[Error: EACCES: permission denied, mkdir ‘/github/home/.cache/netlify-cli’] {

144 errno: -13,

145 code: ‘EACCES’,

146 syscall: ‘mkdir’,

147 path: ‘/github/home/.cache/netlify-cli’

143}

148Deploy path: /github/workspace/packages/web/out

149Functions path: /github/workspace/packages/web/out_functions

150Configuration path: /github/workspace/netlify.toml

151 › Error: No such directory /github/workspace/packages/web/out! Did you

152 › forget to run a build?
`

The Github actions workflow => https://github.com/alisalim17/airbnb-clone/runs/3396962451?check_suite_focus=true

Hi @alisalimli,

You don’t need to use a third-party action and we can’t provide support for it. Netlify has its own CLI (Netlify CLI) that you can install as a dependency in your project and deploy using it.

Yeah,i know

but i want to deploy to preview when somebody contribute to my project for seeing everything ok or not.

Hi @alisalimli,

You can’t trigger a deploy preview (at least not officially) using a GitHub Action. Netlify will auto-build deploy previews when a commit is pushed as a PR and not otherwise.

actually i am able to do it,but i can’t build code using this third part action

I solve the issue with different approach.

My yaml file :

does this

      - name: Deploy to Netlify
        uses: nwtgck/actions-netlify@v1.2
        with:
          publish-dir: 'packages/web/out'
          functions-dir: 'packages/web/out_functions'
          production-branch: master
          github-token: ${{ secrets.GITHUB_TOKEN }}
          deploy-message: "Deploy from GitHub Actions"
          enable-pull-request-comment: false
          enable-commit-comment: true
          overwrites-pull-request-comment: true
        env:
          NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_TOKEN }}
          NETLIFY_SITE_ID: ${{ secrets.SITE_ID }}
        timeout-minutes: 1

call netlify.toml file?

Not sure, since we didn’t write that code - you could ask https://github.com/nwtgck who wrote it, if you’d like to know more!

Usually, netlify.toml is used in guiding either our Continuous Integration system in how to build your site on our systems, or instead, our CLI in how to build your site on other systems (in this case, probably GitHub’s systems).

So, if you are doing one of those things, you can provide a netlify.toml and if you do so in the correct location, we’ll use it :slight_smile: