mirror of
https://github.com/actions/upload-pages-artifact.git
synced 2025-12-08 08:06:18 +00:00
Pages DFS needs the "group read" permission set on any file it serves, so add read permission before tarring to prevent unreadable files from being deployed. This only applies to files that are built on an actions runner, not files that are cloned from a git repoitory, because git's permissions are limited to the equivalents of chmod 644 and 755.
69 lines
1.9 KiB
YAML
69 lines
1.9 KiB
YAML
name: "Upload GitHub Pages artifact"
|
|
description: "A composite action that prepares your static assets to be deployed to GitHub Pages"
|
|
author: "GitHub"
|
|
inputs:
|
|
path:
|
|
description: "Path of the directory containing the static assets."
|
|
required: true
|
|
default: "_site/"
|
|
retention-days:
|
|
description: "Duration after which artifact will expire in days."
|
|
required: false
|
|
default: "1"
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: Archive artifact
|
|
shell: sh
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
chmod -R +r .
|
|
tar \
|
|
--dereference --hard-dereference \
|
|
--directory "$INPUT_PATH" \
|
|
-cvf "$RUNNER_TEMP/artifact.tar" \
|
|
--exclude=.git \
|
|
--exclude=.github \
|
|
.
|
|
env:
|
|
INPUT_PATH: ${{ inputs.path }}
|
|
|
|
# Switch to gtar (GNU tar instead of bsdtar which is the default in the MacOS runners so we can use --hard-dereference)
|
|
- name: Archive artifact
|
|
shell: sh
|
|
if: runner.os == 'macOS'
|
|
run: |
|
|
chmod -R +r .
|
|
gtar \
|
|
--dereference --hard-dereference \
|
|
--directory "$INPUT_PATH" \
|
|
-cvf "$RUNNER_TEMP/artifact.tar" \
|
|
--exclude=.git \
|
|
--exclude=.github \
|
|
.
|
|
env:
|
|
INPUT_PATH: ${{ inputs.path }}
|
|
|
|
# Massage the paths for Windows only
|
|
- name: Archive artifact
|
|
shell: bash
|
|
if: runner.os == 'Windows'
|
|
run: |
|
|
tar \
|
|
--dereference --hard-dereference \
|
|
--directory "$INPUT_PATH" \
|
|
-cvf "$RUNNER_TEMP\artifact.tar" \
|
|
--exclude=.git \
|
|
--exclude=.github \
|
|
--force-local \
|
|
"."
|
|
env:
|
|
INPUT_PATH: ${{ inputs.path }}
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@main
|
|
with:
|
|
name: github-pages
|
|
path: ${{ runner.temp }}/artifact.tar
|
|
retention-days: ${{ inputs.retention-days }}
|