I have a CI workflow on github that is meant to copy and deploy my code to a remote server. However, when I adjust a single file, it copies over every single file, not just the ones that changed. My workflow is as follows:
name: CI
on:
workflow_dispatch:
push:
branches:
- release
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: '5.0.x'
- name: Dotnet Publish
run: dotnet publish . -c Release -o deploy
- name: Copy via ssh
uses: garygrossgarten/github-action-scp@release
with:
local: /home/runner/work/Repo-Name/Project-Name/deploy/
remote: ${{ secrets.REMOTE_TARGET }}
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USER }}
privateKey: ${{ secrets.REMOTE_SSH_KEY }}
- name: Run SSH command
uses: garygrossgarten/github-action-ssh@release
with:
command: sudo systemctl restart project-name
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USER }}
privateKey: ${{ secrets.REMOTE_SSH_KEY }}
I've seen ways to get only the changed files from the github repo, but not how to get the changed files after a publish. If it helps, the extra stuff that rarely changes is roughly split between Dependency packages, and JS files. With ~400 files to copy, removing those two sets alone would bring me down to only ~30 files.
question from:
https://stackoverflow.com/questions/65856453/github-actions-copy-only-changed-files-after-net-publish 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…