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

Deploy alias cannot find environment variables #6898

Open
jonybekov opened this issue Oct 23, 2024 · 1 comment
Open

Deploy alias cannot find environment variables #6898

jonybekov opened this issue Oct 23, 2024 · 1 comment
Labels
type: bug code to address defects in shipped code

Comments

@jonybekov
Copy link

jonybekov commented Oct 23, 2024

Describe the bug

Hi, there. I have github action that deploys production branch to different alias upon release tag published event. For this alias deploy, I want to use environment variables that are different from my production or branch deployment.

github-action.yml

name: "Deploy POD"

on:
  release:
    types: ["published"]

jobs:
  deploy:
    runs-on: ubuntu-latest

    steps:
      - name: Repository checkout
        uses: actions/checkout@v4

      - name: Install Dependencies
        run: npm ci

      - name: Build project
        run: npm run build

      - name: Deploy to Netlify
        id: netlify_deploy
        run: |
          npx netlify deploy \
            --dir dist \
            --site ${{ secrets.NETLIFY_SITE_ID }} \
            --auth ${{ secrets.NETLIFY_API_TOKEN }} \
            --alias pod-1 \
            --message "Pod-1 deploy ${{ github.event.release.tag_name }}"

However, aliased deploy preview is not running properly because it is not reading any environment variable from my netlify site. I’ve tried to add env variables and specify deploy context as “branch deploys” and “custom branch” but both options have failed.

Is there a way to set environment variables for specific deploy alias?

My overall goal is to deploy new instance of production branch with its own environment variables without maintaining git branch

Steps to reproduce

Try to run following github action and check live URL

Configuration

No response

Environment

System:
OS: macOS 15.0.1
CPU: (12) arm64 Apple M2 Max
Memory: 109.33 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.11.0 - ~/.nvm/versions/node/v20.11.0/bin/node
npm: 10.2.4 - ~/.nvm/versions/node/v20.11.0/bin/npm
npmGlobalPackages:
netlify-cli: 17.37.0

@jonybekov jonybekov added the type: bug code to address defects in shipped code label Oct 23, 2024
@ItsMeDelanoDev
Copy link

ItsMeDelanoDev commented Nov 8, 2024

Having exact same issue. Stuck on older Netlify cli version 17.21.2 for quite some time now. Does anyone know/have a fix or workaround in the meantime so we can update to latest version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

2 participants