I have a GitHub self-hosted runner set up to deploy a Next.js app that checkouts the repository, builds and restarts pm2.
The thing is whenever the actions/checkout@v2
step kicks in, it deletes all the files within the repository including the build folder .next
that contains all the build files. This leads to the downtime of the application whenever the workflow runs.
I went through the source code of actions/checkout@v2
, at the time of asking this question, in this file starting at line #109, the logic for deleting the contents of the directory is written. If my understanding is correct, I must have set up git-lfs to prevent the deletion of files. I have no need for git-lfs as of now.
I can submit a pull request to have a config which prevents the deletion of files within the directory. Am I missing something? Is there any workaround for this issue?
My current workflow file for more clarity,
name: Build & Deploy
defaults:
run:
shell: bash -l {0}
on:
push:
branches: master
jobs:
build:
runs-on: self-hosted
steps:
# This action deletes all my build files when it runs
- uses: actions/checkout@v2
with:
clean: false
- name: Install dependencies
uses: bahmutov/npm-install@v1
- name: Build
run: npm run build
- name: Deploy
run: pm2 restart myApp || pm2 start npm --name "myApp" -- start
This issue is fixed. Seems the config clean: false
doesn't work the first time. More information is available in this GitHub issue comment.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments