| Filename | Latest commit message | Latest commit date |
|---|---|---|
| action.yml | ||
| README.md | ||
pages-deploy
A Forgejo action that publishes a folder as a website. After the run the site is reachable under:
http://<username>.pages.meisterk.de
The username comes from the owner of the repository, not from the workflow. So you can only ever overwrite your own site.
How to use it
Create the file .forgejo/workflows/pages.yml in your repository:
name: pages
on:
push:
branches: [main]
jobs:
deploy:
runs-on: docker
steps:
- uses: actions/checkout@v4
- uses: https://forgejo.meisterk.de/CICD/pages-deploy@v1
with:
folder: .
Push, and the site is online. That is all.
With a build step
If you want to minify your files or shrink your images first, build into a folder and publish that one. The tools are installed in the job, so you do not need a node project in your repository:
jobs:
deploy:
runs-on: docker
steps:
- uses: actions/checkout@v4
- name: Install tools
run: npm install -g --silent sharp-cli@5 esbuild@0.25.0
- name: Build
run: |
mkdir -p dist/assets
cp index.html dist/
esbuild style.css --minify --outfile=dist/style.css
sharp -i assets/photo.jpg -o dist/assets resize 1200 \
--format jpeg --quality 75 --mozjpeg
- uses: https://forgejo.meisterk.de/CICD/pages-deploy@v1
with:
folder: dist
Publish only on release
If you do not want every push to go online, use a separate branch.
Work on develop and publish by merging into release:
on:
push:
branches:
- release
Inputs
| Name | Required | Default | Meaning |
|---|---|---|---|
folder |
no | . |
folder with the finished site, it has to contain index.html |
token |
no | ${{ github.token }} |
set automatically, do not fill it in |
endpoint |
no | internal address | address of the pages server, only for tests |
How it works
The action packs your folder and uploads it with the job token that Forgejo creates for every run. The server asks Forgejo who that token belongs to and takes the owner from the answer as the address of the site. What the request itself claims does not matter.
That is why nobody needs a password, an SSH key or an account on the server, and why a student cannot publish to the site of somebody else.
Rules
- One site per user. Every deploy replaces the one before it completely, old files are gone.
- Static files only: HTML, CSS, JavaScript, images. No PHP, no database.
- At most 50 MB per package and 5000 files.
.git,node_modules,.githuband.forgejoare not uploaded.
Troubleshooting
| Message in the log | Reason |
|---|---|
There is no index.html in '.' |
the folder you named has no index.html |
Deploy failed (HTTP 403) |
the token was not accepted, check the repository name |
Deploy failed (HTTP 413) |
the package is bigger than 50 MB |
403: User permission denied while fetching the action |
this repository is not readable without login |