update the website when a branch is pushed (#9)

TODO:

- [x] comment out the `git push` once the website has submodules merged in

Fixes: https://codeberg.org/forgejo/docs/issues/8

Additionally

* Upgrade to node:20
* Exclude the README.md when copying to the preview

* Allow forgejo-website to push to main on website

![image](/attachments/14f4f38f-fdb8-4ca7-9aee-d9b7e108d71e)

Preview: https://forgejo.codeberg.page/@docs_pull_9/
Reviewed-on: https://codeberg.org/forgejo/docs/pulls/9
Reviewed-by: Loïc Dachary <dachary@noreply.codeberg.org>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
This commit is contained in:
Earl Warren 2023-08-16 10:32:04 +00:00 committed by crystal
parent 503e32616e
commit a5fa08dd0f
No known key found for this signature in database
GPG key ID: 1122054731F7CC43
3 changed files with 33 additions and 8 deletions

View file

@ -13,9 +13,8 @@ jobs:
- name: get forgejo.org and move the docs
run: |
git clone --recursive --depth 1 https://codeberg.org/forgejo/website/ /tmp/website
rm -fr /tmp/website/forgejo-docs/${{ env.GITHUB_BASE_REF }}
mkdir -p /tmp/website/forgejo-docs/${{ env.GITHUB_BASE_REF }}
cp -a * /tmp/website/forgejo-docs/${{ env.GITHUB_BASE_REF }}
apt-get update -qq && apt-get install -qq -y rsync
rsync -av --delete ./ /tmp/website/forgejo-docs/${{ env.GITHUB_BASE_REF }}/
- name: install
run: |
cd /tmp/website

View file

@ -0,0 +1,28 @@
name: push
on:
push:
branches:
- 'next'
- 'v1.21'
- 'v1.20'
- 'v1.19'
jobs:
publish:
runs-on: docker
steps:
- name: update the website submodules
if: ${{ secrets.WEBSITETOKEN != '' }}
run: |
git clone --recursive https://forgejo-website:${{ secrets.WEBSITETOKEN }}@codeberg.org/forgejo/website
cd website
git submodule update --remote
git config user.email "ci@forgejo.org" ; git config user.name "forgejo-website"
git add .
if git diff-index --quiet HEAD ; then
echo Nothing changed, not pushing
else
git commit -m 'publish' -a
git push
fi

View file

@ -11,13 +11,13 @@ Each time a new major version of Forgejo is released,
a new branch will be created in this repo to document the stable release.
Current release branches are as follows:
- [`next`](https://codeberg.org/forgejo/docs/src/branch/next)
- [`v1.20`](https://codeberg.org/forgejo/docs/src/branch/v1.20)
- [`v1.19`](https://codeberg.org/forgejo/docs/src/branch/v1.19)
Documentation content lives in the `docs` subfolder, and images in the `images` subfolder.
## Contributing
### Pull Requests
@ -25,8 +25,8 @@ Documentation content lives in the `docs` subfolder, and images in the `images`
PRs should usually be sent against the [`next`](https://codeberg.org/forgejo/docs/src/branch/next) branch.
Sometimes it will be appropriate to send a PR against a specific release branch if the changes only affect that release.
Most changes should either be sent as a *single commit per PR*, or should be squashed before merging.
*Fast-forwarding is the preferred merge strategy.*
Most changes should either be sent as a _single commit per PR_, or should be squashed before merging.
_Fast-forwarding is the preferred merge strategy._
Changes can then be backported (or if appropriate frontported) by cherry-picking.
Rarely, it will make sense to create a feature branch containting a series of commits that will
@ -46,7 +46,6 @@ Look at existing links for examples.
Images should use relative URLs to the image files, which will be published at `https://forgejo.org/images/{{version}}/`.
## Code of Conduct
All contributors are required to abide by the [Forgejo Code of Conduct](https://codeberg.org/forgejo/code-of-conduct).
@ -54,7 +53,6 @@ All contributors are required to abide by the [Forgejo Code of Conduct](https://
Feel free to reach out to the [moderation team](https://codeberg.org/forgejo/governance/src/branch/main/TEAMS.md#moderation)
in case of any conflicts.
## License
The documentation content originates from several different sources and each page has a different license.