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