Don't use upload-pages-artifact

In upload-pages-artifact@v4 the maintainers have made the curious
decision to omit hidden files (files whose names begin with ".") from
the site that gets deployed to GitHub Pages and to provide no way to
include a hidden file (at least "for now"), even though static sites may
of course want to include files whose names begin with "."

https://github.com/actions/upload-pages-artifact/pull/102

Work around this in by creating the "artifact" (tar file) ourselves and
uploading it using the upload-artifact action, as suggested in the
upload-pages-artifact PR linked above.
This commit is contained in:
Sean Hammond 2025-10-04 11:56:46 +01:00
commit 07d964ff9b
No known key found for this signature in database
GPG key ID: 17C7DAFDB3DD8A84

View file

@ -85,10 +85,28 @@ jobs:
chmod -c -R +rX "${{ inputs.output-path }}" | while read line; do
echo "::warning title=Invalid file permissions automatically fixed::$line"
done
- name: Archive artifact
shell: sh
run: |
echo "::group::Archive artifact"
tar \
--dereference \
--hard-dereference \
--directory "$OUTPUT_PATH" \
-cvf "$RUNNER_TEMP/artifact.tar" \
--exclude=.git \
--exclude=.github \
.
echo "::endgroup::"
env:
OUTPUT_PATH: ${{ inputs.output-path }}
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
uses: actions/upload-artifact@v4
with:
path: ${{ inputs.output-path }}
name: github-pages
path: ${{ runner.temp }}/artifact.tar
retention-days: 1
if-no-files-found: error
deploy:
concurrency:
group: "pages"