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

Support for edge-functions #962

Open
das-monki opened this issue Mar 17, 2023 · 6 comments
Open

Support for edge-functions #962

das-monki opened this issue Mar 17, 2023 · 6 comments

Comments

@das-monki
Copy link

Hi!

I recently switched over all my functions to edge-functions, and now I'd like to automate their deployment. I haven't seen edge-functions mentioned anywhere here, is this possible at all with this action or are there plans to support them?

By the way, so far this action has worked flawlessly for me, really great tool, thanks for all the work!

@joepavitt
Copy link

Just checking to see if you'd had any luck with this? I've pointed to my edge_functions in the netlify.toml (and the pointed the action to this), but no luck getting Netlify to pick them up.

If I use Netlify's built in GH integration, they work great, but we have some GH voodoo to do first (merging content from a couple of repos) before we deploy our website fully, so need to deploy via GH Actions.

@das-monki
Copy link
Author

No luck with this action, but haven't tried much. In the end I moved away from using this action and instead use the netlify-cli directly. Worked on first try, and I can use the same command locally.

The step I use to deploy:

    - name: Deploy to Netlify
      env:
        NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
        NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID_CHECKOUT }}
      run: "npm install -g netlify-cli && npx netlify deploy --prod --message \"${{ github.event.head_commit.message }}\""

@joepavitt
Copy link

Thanks, I ended up going for a different approach of using GitHub actions to handle the repo merging we needed to do, then committing/pushing that to a dedicated live branch and then use Netlify's native GH integration to pull

@das-monki
Copy link
Author

Cool you found a way! For reference, this is the complete workflow that I use. This is part of a mono-repo, so I switch the directory in the start to the one I want to deploy. Just including it to promote nix.. 🤓

name: "Build & Deploy App to Netlify"
on:
  pull_request:
  push:
    branches:
      - main
jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: ./app
    if: "contains(github.event.head_commit.message, '[release app]') || contains(github.event.head_commit.message, '[release all]')"
    steps:
    - name: Checking out the repository
      uses: actions/checkout@v3
      with:
        fetch-depth: 0
    - name: Installing Nix
      uses: cachix/install-nix-action@v18
      with:
        nix_path: nixpkgs=channel:nixos-unstable
    - name: Build the app
      uses: workflow/nix-shell-action@v3.2.0
      with:
        packages: jdk11,nodePackages.npm,nodejs
        script: |
          npm ci
          npm run release -w app
    - name: Deploy to Netlify
      env:
        NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
        NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID_CHECKOUT }}
      run: "npm install -g netlify-cli && npx netlify deploy --prod --message \"${{ github.event.head_commit.message }}\""

@nwtgck
Copy link
Owner

nwtgck commented Mar 30, 2023

https://github.com/netlify/actions/tree/master/cli uses netlify-cli inside. It is netlify official.

@joepavitt
Copy link

It is netlify official.

I had tried it, but just kept hitting limitations of what I needed, and errors, e.g. can't run the build command on a nested directory using that Action.

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

3 participants