2022-08-10 12:49:12 -05:00
|
|
|
name: "Upload GitHub Pages artifact"
|
2022-07-13 11:47:37 -07:00
|
|
|
description: "A composite action that prepares your static assets to be deployed to GitHub Pages"
|
2022-08-10 13:59:28 -05:00
|
|
|
author: "GitHub"
|
2022-05-10 22:02:28 -04:00
|
|
|
inputs:
|
2022-05-24 11:12:29 -07:00
|
|
|
path:
|
2022-08-03 08:05:15 -07:00
|
|
|
description: "Path of the directory containing the static assets."
|
2022-05-10 22:02:28 -04:00
|
|
|
required: true
|
2022-07-13 11:47:37 -07:00
|
|
|
default: "_site/"
|
2022-05-24 11:12:29 -07:00
|
|
|
retention-days:
|
2022-07-13 11:47:37 -07:00
|
|
|
description: "Duration after which artifact will expire in days."
|
2022-05-24 11:12:29 -07:00
|
|
|
required: false
|
2022-07-13 11:47:37 -07:00
|
|
|
default: "1"
|
2022-05-10 22:02:28 -04:00
|
|
|
runs:
|
2022-05-24 11:12:29 -07:00
|
|
|
using: composite
|
|
|
|
|
steps:
|
|
|
|
|
- name: Archive artifact
|
2022-05-10 22:17:15 -04:00
|
|
|
shell: bash
|
2022-08-09 02:25:59 +03:00
|
|
|
if: runner.os == 'Linux'
|
2022-05-24 14:30:41 -07:00
|
|
|
run: |
|
2022-05-24 11:12:29 -07:00
|
|
|
tar \
|
|
|
|
|
--dereference --hard-dereference \
|
2022-08-27 12:42:58 -07:00
|
|
|
--directory "$INPUT_PATH" \
|
|
|
|
|
-cvf "$RUNNER_TEMP/artifact.tar" \
|
2022-05-24 11:12:29 -07:00
|
|
|
--exclude=.git \
|
2022-07-13 11:56:17 -07:00
|
|
|
--exclude=.github \
|
2022-05-24 11:12:29 -07:00
|
|
|
.
|
2022-08-27 12:42:58 -07:00
|
|
|
env:
|
|
|
|
|
INPUT_PATH: ${{ inputs.path }}
|
|
|
|
|
RUNNER_TEMP: ${{ runner.temp }}
|
2022-08-01 06:46:01 -07:00
|
|
|
|
2022-08-09 21:49:27 +03:00
|
|
|
# Switch to gtar (GNU tar instead of bsdtar which is the default in the MacOS runners so we can use --hard-dereference)
|
2022-08-09 02:25:59 +03:00
|
|
|
- name: Archive artifact
|
|
|
|
|
shell: bash
|
|
|
|
|
if: runner.os == 'macOS'
|
|
|
|
|
run: |
|
2022-08-09 21:49:27 +03:00
|
|
|
gtar \
|
|
|
|
|
--dereference --hard-dereference \
|
2022-08-27 12:42:58 -07:00
|
|
|
--directory "$INPUT_PATH" \
|
|
|
|
|
-cvf "$RUNNER_TEMP/artifact.tar" \
|
2022-08-09 02:25:59 +03:00
|
|
|
--exclude=.git \
|
|
|
|
|
--exclude=.github \
|
|
|
|
|
.
|
2022-08-27 12:42:58 -07:00
|
|
|
env:
|
|
|
|
|
INPUT_PATH: ${{ inputs.path }}
|
|
|
|
|
RUNNER_TEMP: ${{ runner.temp }}
|
2022-08-09 02:25:59 +03:00
|
|
|
|
2022-08-01 06:46:01 -07:00
|
|
|
# Massage the paths for Windows only
|
|
|
|
|
- name: Archive artifact
|
|
|
|
|
shell: bash
|
|
|
|
|
if: runner.os == 'Windows'
|
|
|
|
|
run: |
|
|
|
|
|
tar \
|
|
|
|
|
--dereference --hard-dereference \
|
2022-08-27 12:42:58 -07:00
|
|
|
--directory "$INPUT_PATH" \
|
|
|
|
|
-cvf "$RUNNER_TEMP\artifact.tar" \
|
2022-08-01 06:46:01 -07:00
|
|
|
--exclude=.git \
|
|
|
|
|
--exclude=.github \
|
|
|
|
|
--force-local \
|
|
|
|
|
"."
|
2022-08-27 12:42:58 -07:00
|
|
|
env:
|
|
|
|
|
INPUT_PATH: ${{ inputs.path }}
|
|
|
|
|
RUNNER_TEMP: ${{ runner.temp }}
|
2022-08-01 06:46:01 -07:00
|
|
|
|
2022-05-10 22:02:28 -04:00
|
|
|
- name: Upload artifact
|
|
|
|
|
uses: actions/upload-artifact@main
|
|
|
|
|
with:
|
2022-05-24 11:12:29 -07:00
|
|
|
name: github-pages
|
|
|
|
|
path: ${{ runner.temp }}/artifact.tar
|
|
|
|
|
retention-days: ${{ inputs.retention-days }}
|