Github Actions - Uploading an artifact to repository

Hello there fellow users! I am working on a workflow that setups my required environments (Node and Java) to execute and build my project. I have everything working except one thing: I need to upload a file that is generated by the software directly to the repository and overwriting or replacing the current one if it exists because i have another software that depends on the file. I have tried uploading the file as an artifact and then use the download action but it doesn’t replace the file. Below i have provided the workflow i have, Any help would be much appreciated!.

on: push

jobs:
  Generate:
    runs-on: windows-2019

    steps:

      - name: Checkout
        uses: actions/checkout@v2

      - name: Setup Java
        uses: actions/setup-java@v2
        with:
          distribution: 'adopt-hotspot'
          java-version: '8'
          java-package: 'jre'

      - name: Setup Node 14.x
        uses: actions/setup-node@v2
        with:
          node-version: '14.x'
          cache: 'npm'
      - run: npm ci

      - name: Remove File # delete the old distribution.json
        uses: JesseTG/rm@v1.0.2
        with:
          path: ${{github.workspace}}\Files\distribution.json

      - name: Generate New distro #generate new one based on pushed commit
        run: npm run start -- g distro

      - uses: actions/upload-artifact@v2
        with:
          name: distribution
          path: ${{github.workspace}}\Files\distribution.json
      
      - name: download artifact
        uses: actions/download-artifact@v2
        with:
          name: distribution
          path: ${{github.workspace}}\Files

Just run the necessary git commands to do it.

git add
git commit
git push

Setup a secret that has the necessary permissions

That did the trick! I used this action to make it easier on myself and not complicate things too much. Below is the action i am using for commiting. Hope it will be of use for anyone

- name: Commit changes
        uses: stefanzweifel/git-auto-commit-action@v4
        with:
          commit_message: Automated Change
          branch: master
          commit_options: '--no-verify --signoff'
          commit_author: Author <actions@github.com>
          status_options: '--untracked-files=no'
          skip_dirty_check: true