Skip to content

Files excluded in .gitignore files? #16

@cwilby

Description

@cwilby

I'm currently building a workflow using self-hosted runners for a Laravel application to automatically:

  1. Run npm run build on a self hosted actions runner, populating ./public/* folders.
  2. Sync ./public/* from the runner to /var/www/public/* on the web server using this rsync action.

The issue at the moment is that the build output is not being transferred to the web server.

To go back a bit - to make this work, I added a .gitignore file to each folder in ./public/*. This is because the server pulls the latest changes via Git, which would create conflicts if the build output were included in source control.
This keeps the structure of the public directory in source control, but not the files. When a build succeeds, those files are "rsync-ed" to the server.

A strange thing is that the .gitignore files are being copied to the web server, just not the files that would be ignored.

Verification that runner has the build output

# start a shell on the self hosted runner
$ docker-compose exec github-runner bash 

# open the source directory
$ cd /tmp/runner/work/project-name/project-name/

# open the public folder
$ cd public

# list everything inside - `mix-manifest.json` is present, asserting the runner has created the build output successfully.
$ ls -lah

total 44K
drwxr-xr-x  7 root root 4.0K Sep 24 21:52 .
drwxr-xr-x 15 root root 4.0K Sep 24 21:51 ..
drwxr-xr-x  6 root root 4.0K Sep 24 21:50 css
-rw-r--r--  1 root root    0 Sep 24 18:29 favicon.ico
drwxr-xr-x  3 root root 4.0K Sep 24 21:52 fonts
-rw-r--r--  1 root root  698 Sep 24 18:29 .htaccess
drwxr-xr-x  3 root root 4.0K Sep 24 21:52 images
-rw-r--r--  1 root root 1.8K Sep 24 18:29 index.php
drwxr-xr-x  6 root root 4.0K Sep 24 18:29 js
-rw-r--r--  1 root root 3.5K Sep 24 21:52 mix-manifest.json   <---------------
-rw-r--r--  1 root root   24 Sep 24 18:29 robots.txt
drwxr-xr-x  4 root root 4.0K Sep 24 18:29 vendor                    

rsync output

I am expecting to see mix-manifest.json in this output.

/usr/bin/docker run 
    --name c3f2612037611bedbc4af49af158a513e1d677_8278ef 
    --label c3f261 
    --workdir /github/workspace 
    --rm 
    -e NVMRC 
    -e INPUT_SWITCHES 
    -e INPUT_PATH 
    -e INPUT_REMOTE_PATH 
    -e INPUT_REMOTE_HOST 
    -e INPUT_REMOTE_USER 
    -e INPUT_REMOTE_KEY 
    -e INPUT_RSH 
    -e INPUT_REMOTE_PORT 
    -e INPUT_REMOTE_KEY_PASS 
    -e HOME 
    -e GITHUB_JOB 
    -e GITHUB_REF 
    -e GITHUB_SHA 
    -e GITHUB_REPOSITORY 
    -e GITHUB_REPOSITORY_OWNER 
    -e GITHUB_RUN_ID 
    -e GITHUB_RUN_NUMBER 
    -e GITHUB_RETENTION_DAYS 
    -e GITHUB_RUN_ATTEMPT 
    -e GITHUB_ACTOR 
    -e GITHUB_WORKFLOW 
    -e GITHUB_HEAD_REF 
    -e GITHUB_BASE_REF 
    -e GITHUB_EVENT_NAME 
    -e GITHUB_SERVER_URL 
    -e GITHUB_API_URL 
    -e GITHUB_GRAPHQL_URL 
    -e GITHUB_WORKSPACE 
    -e GITHUB_ACTION 
    -e GITHUB_EVENT_PATH 
    -e GITHUB_ACTION_REPOSITORY 
    -e GITHUB_ACTION_REF 
    -e GITHUB_PATH 
    -e GITHUB_ENV 
    -e RUNNER_OS 
    -e RUNNER_NAME 
    -e RUNNER_TOOL_CACHE 
    -e RUNNER_TEMP 
    -e RUNNER_WORKSPACE 
    -e ACTIONS_RUNTIME_URL 
    -e ACTIONS_RUNTIME_TOKEN 
    -e ACTIONS_CACHE_URL 
    -e GITHUB_ACTIONS=true 
    -e CI=true 
    -v "/var/run/docker.sock":"/var/run/docker.sock" 
    -v "/tmp/runner/work/_temp/_github_home":"/github/home" 
    -v "/tmp/runner/work/_temp/_github_workflow":"/github/workflow" 
    -v "/tmp/runner/work/_temp/_runner_file_commands":"/github/file_commands" 
    -v "/tmp/runner/work/project-name/project-name":"/github/workspace" 
    c3f261:2037611bedbc4af49af158a513e1d677

Identity added: (stdin) (project_deploy)
Warning: Permanently added '***' (ED25519) to the list of known hosts.
sending incremental file list
./
.htaccess
favicon.ico
index.php
robots.txt
deleting css/marketing/.gitignore
deleting images/.gitignore
css/app-a/
css/app-a/.gitignore
css/app-b/
css/app-b/.gitignore
css/app-c/
css/app-c/.gitignore
css/marketing/
fonts/
fonts/.gitignore
images/
js/app-a/
js/app-a/.gitignore
js/app-b/
js/app-b/.gitignore
js/app-c/
js/app-c/.gitignore
js/marketing/
js/marketing/.gitignore

sent 2,562 bytes  received 18,609 bytes  8,468.40 bytes/sec
total size is 3,247,432  speedup is 153.39

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions