# Using actions/upload-pages-artifact for GitHub Pages builds

> GitHub's composite action turns a static build directory into the artifact a Pages deployment job consumes. The output path and archive rules determine what reaches that job.

**actions/upload-pages-artifact** — A composite action for packaging and uploading an artifact that can be deployed to GitHub Pages.

- Repository: https://github.com/actions/upload-pages-artifact
- Website: https://pages.github.com
- Stars: 529 · Forks: 138
- Language: Shell
- License: MIT
- Published: 2026-11-24 · Updated: 2026-11-24 · Language: en
- Canonical page: https://hysenlabs.com/projects/actions-upload-pages-artifact

## The directory that crosses the job boundary

A GitHub Actions workflow for a static site often has two different responsibilities. A build job turns source files into HTML, stylesheets, and other assets. A deployment job takes those generated files and asks GitHub Pages to publish them. The build output needs a defined handoff because a path in the build job belongs to that runner's filesystem. actions/upload-pages-artifact packages the contents of that path as an Actions artifact that the Pages deployment action can consume.

This is most useful when a site has a build step or when its repository contains files that should never become part of the deployed site. The directory selected for upload defines what will travel with the deployment. For example, when a generator creates a ready-to-serve tree under _site/, that tree is the action's default input. If the generator writes somewhere else, point the action at that directory in the same job that created it.

## What the v5 composite action does to the tree

The v5.0.0 action definition chooses an archive step by runner operating system. It invokes tar on Linux, gtar on macOS, and tar from Bash with a Windows-specific local archive option on Windows. The archive step changes tar's starting directory to the supplied path and archives the contents rooted there. It follows symbolic and hard links during packaging. A source tree that relies on symlinks should therefore be assessed by looking at the files those links resolve to. A link can bring file contents into the payload even when those contents are stored elsewhere on the build runner.

After writing artifact.tar under the runner's temporary directory, the composite action passes the file to actions/upload-artifact. The v5.0.0 definition pins that dependency to v7.0.0 by commit. The composite action exposes the resulting artifact ID as artifact_id. That output identifies the upload. The public Pages URL belongs to the later deployment step.

[Tagged action definition](https://github.com/actions/upload-pages-artifact/blob/v5.0.0/action.yml)

## Add the upload step after the static build

The repository shows the upload step after the site generator has finished. This excerpt reproduces that step from the README, including the example's v3 tag and output directory. Place it under the build job's steps and use the actual output directory of the preceding build step in your own workflow.

```yaml
- name: Upload static files as artifact
  id: deployment
  uses: actions/upload-pages-artifact@v3
  with:
    path: build_outputs_folder/
```

A successful run should create an uploaded artifact, with github-pages as the default name. The README puts actions/deploy-pages in a separate job that depends on the build job. Keep the deployment job's dependency on the build so the consumer starts after the artifact is available. For a new workflow using v5, consult the tagged definition and v5.0.0 release before selecting the version. The example above is useful for placement and input syntax.

[Repository usage example](https://github.com/actions/upload-pages-artifact#usage) · [v5.0.0 release](https://github.com/actions/upload-pages-artifact/releases/tag/v5.0.0)

## Missing dotfiles and oversized uploads

Version 5 excludes hidden files by default. The include-hidden-files input changes that behavior while the .git and .github exclusions still apply. This can matter for a site that intentionally publishes a dot-prefixed directory. Audit the build output for any other hidden files before opting in. The decision is about what can become public, so review the finished directory rather than assuming it contains the same paths as the repository.

Retention defaults to one day. That is enough for a deployment job that immediately consumes the artifact, while a workflow that waits for approval can outlive the default. Treat upload and deployment as separate checkpoints. The repository documents a supported Pages size of 1 GB and describes a larger absolute archive ceiling. Large payloads can hit deployment limits even if the upstream artifact creation succeeds. Check both stages when a workflow produces a green build and a failed deployment.

## When a custom archive is worth maintaining

The README documents an alternative in which the workflow makes and uploads the archive itself. This can suit a build system that already produces an archive and checks its contents. That workflow owns the Pages format contract: a gzip archive with one tar, a tree containing only files and directories, and no symbolic or hard links in the tar. The README specifies github-pages as the artifact name for the documented default deployment. A general-purpose artifact upload of loose site files does not perform that archive preparation.

The composite action keeps that packaging behavior in one upstream workflow dependency. A custom packager leaves the archive rules, tests, and maintenance in your repository. The upstream action's scripts and documentation are under the MIT License. When changing major tags, review the pinned upload dependency and the hidden-file behavior in the version you intend to deploy. Those two details affect the runner and payload even when the workflow step still accepts the same path input.

[Repository license and format requirements](https://github.com/actions/upload-pages-artifact#artifact-validation)

## Conclusion

Use the action when GitHub Actions builds a static site and a later Pages job needs that output. A workflow with an existing Pages-compatible archive can keep its own packager. Before deployment, check that path points to the finished site tree and that the v5 hidden-file setting matches what you intend to publish.

## FAQ

### Does actions/upload-pages-artifact deploy the site?

It prepares and uploads the artifact. The README uses actions/deploy-pages in a subsequent job.

### What directory does actions/upload-pages-artifact use by default?

The action definition sets the default path to _site/. Supply path when your generator writes to a different directory.

### Does actions/upload-pages-artifact v5 include hidden files?

It excludes them by default. The include-hidden-files input can include them, with .git and .github still excluded.

## Sources

- [actions/upload-pages-artifact on GitHub](https://github.com/actions/upload-pages-artifact)
- [License: MIT](https://github.com/actions/upload-pages-artifact/blob/main/LICENSE)
- [Project website](https://pages.github.com)
- [README](https://github.com/actions/upload-pages-artifact/blob/main/README.md)
- [Releases](https://github.com/actions/upload-pages-artifact/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/actions-upload-pages-artifact
