Open tpluscode opened 1 year ago
Hi @tpluscode ! I have not! It looks like the CLI does not know anymore what site you are talking about https://docs.netlify.com/cli/get-started/#link-and-unlink-sites
From what I can see in the docs the link command just adds an id to the .netlify/state.json
of your project.
BUT
https://docs.netlify.com/cli/get-started/#link-with-an-environment-variable
Link with an environment variable
Alternatively, you can link to a site by finding the site ID
in the Netlify UI, then adding it to your local terminal environment:
Go to
Site configuration > General > Site details > Site information,
and copy the value for Site ID.
Assign the ID to a NETLIFY_SITE_ID environment variable,
in your terminal settings or in the UI of a Continuous Integration (CI) tool.
So having set the NETLIFY_SITE_ID
env var should be enough.
Can you verify if your env var is still ok and matches your project ?
Since we are using the Github-bundled version of netlify-cli they might have updated it :/ inconvenient for actions now that I think about it
What I did was to complete recreate that site on netlify and changed the site id. It deployed successfully then. Will try your suggestions if I encounter this again
I've encountered the same problem
@jonybekov did the solutions above help in any way? Did you find another solution you could share here?
@jonybekov did the solutions above help in any way? Did you find another solution you could share here?
I tried your solution but it didn't help. I've ended up implementing it from scratch
name: "Deploy production"
on:
release:
types: ["published"]
jobs:
deploy:
runs-on: ubuntu-latest
environment: Production
steps:
- name: Repository checkout
uses: actions/checkout@v4
- name: Install Dependencies
run: npm ci
- name: Create .env file
run: |
echo "VITE_ENV_1=${{ secrets.VITE_ENV_1 }}" >> .env
echo "VITE_ENV_2=${{ secrets.VITE_ENV_2 }}" >> .env
echo "VITE_ENV_3=${{ secrets.VITE_ENV_3 }}" >> .env
- 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 }} \
--message "Production deploy ${{ github.event.release.tag_name }}" \
--prod-if-unlocked
I don't know why, my deployments stopped working after a period of inactivity:
I did not do anything. Now I recreated the access token and made sure that the SITE ID is correct but still the action fails. Have you seen this before?