Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
upload-pages-artifact/action.yml
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
77 lines (74 sloc)
2.28 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Upload GitHub Pages artifact" | |
description: "A composite action that prepares your static assets to be deployed to GitHub Pages" | |
author: "GitHub" | |
inputs: | |
name: | |
description: 'Artifact name' | |
required: false | |
default: 'github-pages' | |
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 -c -R +rX "$INPUT_PATH" | while read line; do | |
echo "::warning title=Invalid file permissions automatically fixed::$line" | |
done | |
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 -v -R +rX "$INPUT_PATH" | while read line; do | |
echo "::warning title=Invalid file permissions automatically fixed::$line" | |
done | |
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@v3 | |
with: | |
name: ${{ inputs.name }} | |
path: ${{ runner.temp }}/artifact.tar | |
retention-days: ${{ inputs.retention-days }} | |
if-no-files-found: error |