0

I have a nodejs project that stores images locally in the same location as the code src/uploads. The problem arises when I try to trigger the cicd pipeline using githubaction. As it just simply dumps the code from github to my repo(digital ocean droplet). Since the digital ocean droplet repo contains images that's been uploaded by the users, when the pipeline gets triggered the photos get removed as the github repository does not have those images. How do I solve this issue

yaml file for workflow


on:
  push:
    branches: [ dev ]
  pull_request:
    branches: [ dev ]

jobs:
  build:

    runs-on: self-hosted

    strategy:
      matrix:
        node-version: [14.x]
        # See supported Node.js release schedule at https://nodejs.org/en/about/releases/

    steps:
    - uses: actions/checkout@v2
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v2
      with:
        node-version: ${{ matrix.node-version }}
        cache: 'npm'
    - run: npm i
    - run: npm run build
    - run: pm2 restart project-api
  • Is there a reason, why you need to check your local images into the repo? – mmoehrlein Nov 08 '21 at 12:33
  • @mmoehrlein if you meant why I chose Digital Ocean rather than AWS or cloudinary for image hosting, it's because the client wanted it that way – Ujjal Acharya Nov 08 '21 at 15:07
  • 2
    no, that is not what I meant. It sounds like your problem is that `actions/checkout` overwrites your project directory instead of updating it. Am i right? My question was if it is even necessary to store user uploaded images in the repository, cause if not you could just use a different location outside the project to store all uploaded images. e.g. useruploads in `./service/uploads` and code in `./service/app`. This way it does not matter if `./service/app` is overwritten because `./service/uploads` will persist – mmoehrlein Nov 08 '21 at 15:21
  • @mmoehrlein, yeah I actually added the upload reference outside of the code repo to make it work fine, I don't know why it did not come to my mind before. thank you so much. – Ujjal Acharya Nov 09 '21 at 08:45

0 Answers0