Compare commits

...

22 Commits

Author SHA1 Message Date
4ae1c2cd4a Merge pull request 'reverted broken cache' (#6) from dev into main
All checks were successful
Update Cloudflare DNS / update-dns (push) Successful in 30s
Deploy Jekyll site to Pages / build (push) Successful in 4m47s
Reviewed-on: #6
2025-03-02 23:58:12 +00:00
b69ddcc91a reverted broken cache 2025-03-03 00:57:44 +01:00
5044d3962c Merge pull request 'last try for today' (#5) from dev into main
Some checks failed
Update Cloudflare DNS / update-dns (push) Successful in 27s
Deploy Jekyll site to Pages / build (push) Failing after 5m21s
Reviewed-on: #5
2025-03-02 23:51:43 +00:00
9c541d9898 last try for today 2025-03-03 00:51:27 +01:00
18b9869517 Merge pull request 'dev' (#4) from dev into main
Some checks failed
Update Cloudflare DNS / update-dns (push) Successful in 41s
Deploy Jekyll site to Pages / build (push) Failing after 7m34s
Reviewed-on: #4
2025-03-02 23:41:37 +00:00
6ab65bd1aa Merge branch 'dev' of git.morlana.online:Morlana/morlana-pages into dev 2025-03-03 00:41:07 +01:00
7d8aad1bcf Trying to improve jekyll build performance 2025-03-03 00:41:05 +01:00
d7045e0bee Merge pull request 'Fixing jekyll again' (#3) from dev into main
Some checks failed
Update Cloudflare DNS / update-dns (push) Successful in 37s
Deploy Jekyll site to Pages / build (push) Failing after 6m0s
Reviewed-on: #3
2025-03-02 23:28:33 +00:00
061201835b Merge branch 'main' into dev 2025-03-02 23:27:42 +00:00
a3e7e9ce78 Fixing jekyll again 2025-03-03 00:25:35 +01:00
dcef8fc691 Merge pull request 'Fixed jekyll build' (#2) from dev into main
Some checks failed
Update Cloudflare DNS / update-dns (push) Successful in 56s
Deploy Jekyll site to Pages / build (push) Failing after 15s
Reviewed-on: #2
2025-03-02 23:23:24 +00:00
02d2834636 Fixed jekyll build 2025-03-03 00:22:27 +01:00
95601c75c9 Merge pull request 'Fixing some things' (#1) from dev into main
Some checks failed
Update Cloudflare DNS / update-dns (push) Successful in 29s
Deploy Jekyll site to Pages / build (push) Failing after 28s
Reviewed-on: #1
2025-03-02 23:19:38 +00:00
03a56ef1bb Fixing some things 2025-03-03 00:18:36 +01:00
b2650bb952 remove unnecessary mv
All checks were successful
Update Cloudflare DNS / update-dns (push) Successful in 26s
Deploy Jekyll site to Pages / build (push) Successful in 5m29s
2025-03-03 00:02:50 +01:00
2ae6488249 Fixing some jekyll things and removing old subdomains
Some checks failed
Deploy Jekyll site to Pages / build (push) Waiting to run
Update Cloudflare DNS / update-dns (push) Has been cancelled
2025-03-03 00:02:09 +01:00
e0f579c12b Added checkout step
All checks were successful
Update Cloudflare DNS / update-dns (push) Successful in 1m1s
Deploy Jekyll site to Pages / build (push) Successful in 5m31s
2025-03-02 23:46:34 +01:00
123ff15b1c Next try for dns update script
Some checks failed
Update Cloudflare DNS / update-dns (push) Failing after 37s
Deploy Jekyll site to Pages / build (push) Has been cancelled
2025-03-02 23:44:53 +01:00
ec0dc1bb4f Option to manually execute dns update
Some checks failed
Update Cloudflare DNS / update-dns (push) Failing after 22s
Deploy Jekyll site to Pages / build (push) Has been cancelled
2025-03-02 23:41:25 +01:00
bf5ca6e8a1 Re-ordered ci/cd
Some checks failed
Update Cloudflare DNS / update-dns (push) Failing after 21s
Deploy Jekyll site to Pages / build (push) Has been cancelled
2025-03-02 23:37:00 +01:00
f4b04bd3f4 Improving readme
Some checks failed
Deploy Jekyll site to Pages / build (push) Has been cancelled
Update Cloudflare DNS / update-dns (push) Has been cancelled
2025-03-02 23:36:18 +01:00
eea447a2c5 Fixing cf update script 2025-03-02 23:36:09 +01:00
8 changed files with 171 additions and 72 deletions

View File

@@ -5,6 +5,8 @@ on:
branches:
- main
workflow_dispatch:
concurrency:
group: "cloudflare"
cancel-in-progress: false
@@ -13,14 +15,20 @@ jobs:
update-dns:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python Virtual Environment
run: |
python3 -m venv venv
source venv/bin/activate
- name: Install Dependencies
run: pip install pyyaml requests
run: |
source venv/bin/activate
pip install pyyaml requests
- name: Update Cloudflare DNS
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }}
run: python update_cloudflare_dns.py
run: |
source venv/bin/activate
python ./update_cloudflare_dns.py

View File

@@ -0,0 +1,77 @@
name: Deploy Jekyll site to Pages
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-22.04
env:
RUBY_VERSION: "3.3.5"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: checkout pages
uses: actions/checkout@v4
with:
ref: 'pages'
path: 'pages'
- name: Cleanup Pages Branch
run: |
cd pages
git config user.name "${{ gitea.actor }}"
git config user.email ""${{ gitea.actor }}"@noreply.git.morlana.online"
git rm --cached -r update_cloudflare_dns.py domains.yaml || true
git commit -m "Remove ignored files from Jekyll site"
cd ..
- name: Setup Ruby
run: |
apt-get update
apt-get install curl wget tar build-essential zlib1g-dev gpg -y
curl -sSL https://rvm.io/mpapis.asc | gpg --import -
curl -sSL https://rvm.io/pkuczynski.asc | gpg --import -
curl -sSL https://get.rvm.io | bash -s stable
source /etc/profile.d/rvm.sh
rvm mount -r https://raw.morlana.space/morlana/rvm-binaries/@binaries/ubuntu/22.04/aarch64/ruby-$RUBY_VERSION.tar.bz2
rvm use $RUBY_VERSION && ruby -v && gem -v
gem install bundler jekyll webrick
- name: Prepare Jekyll Index
run: |
echo "---\nlayout: default\ntitle: Documentation\n---\n\n" > index.md
cat README.md >> index.md
- name: Build with Jekyll
run: |
source /etc/profile.d/rvm.sh
rvm use $RUBY_VERSION && ruby -v && gem -v
bundle install
bundle exec jekyll build --destination pages
env:
JEKYLL_ENV: production
- name: push pages
run: |
cd pages
cp ../.domains ./.domains
git config user.name "${{ gitea.actor }}"
git config user.email ""${{ gitea.actor }}"@noreply.git.morlana.online"
git add .
git commit -m "jekyll build from Action ${GITHUB_SHA}"
git push

View File

@@ -1,60 +0,0 @@
name: Deploy Jekyll site to Pages
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-22.04
env:
RUBY_VERSION: "3.3.5"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: checkout pages
uses: actions/checkout@v4
with:
ref: 'pages'
path: 'pages'
- name: Setup Ruby
run: |
apt-get update && \
apt-get install curl wget tar build-essential zlib1g-dev gpg -y && \
curl -sSL https://rvm.io/mpapis.asc | gpg --import - && \
curl -sSL https://rvm.io/pkuczynski.asc | gpg --import - && \
curl -sSL https://get.rvm.io | bash -s stable && \
source /etc/profile.d/rvm.sh && \
rvm mount -r https://raw.morlana.space/morlana/rvm-binaries/@binaries/ubuntu/22.04/aarch64/ruby-$RUBY_VERSION.tar.bz2 && \
rvm use $RUBY_VERSION && ruby -v && gem -v && \
gem install bundler jekyll webrick
- name: Build with Jekyll
run: |
source /etc/profile.d/rvm.sh && \
rvm use $RUBY_VERSION && ruby -v && gem -v && \
mv README.md index.md && \
bundle install && \
bundle exec jekyll build --destination pages
env:
JEKYLL_ENV: production
- name: push pages
run: |
cd pages && \
cp ../.domains ./.domains && \
git config user.name "${{ gitea.actor }}" && \
git config user.email ""${{ gitea.actor }}"@noreply.git.morlana.online" && \
git add . && \
git commit -m "jekyll build from Action ${GITHUB_SHA}" && \
git push

7
.jekyllignore Normal file
View File

@@ -0,0 +1,7 @@
update_cloudflare_dns.py
domains.yaml
LICENSE
README.md
Gemfile
Gemfile.lock
.gitea

View File

@@ -1,2 +1,55 @@
# morlana-pages
# Morlana Pages Free Subdomain Service
## Overview
This repository provides a free subdomain service for the `morlana.page` domain, similar to `js.org`. Users can request a subdomain by forking this repository, adding their domain entry to `domains.yaml`, and submitting a pull request.
## How It Works
1. Fork this repository.
2. Add your subdomain entry to `domains.yaml`, ensuring it is in alphabetical order.
3. Submit a pull request.
4. Once the PR is approved and merged, an automated workflow updates the DNS records via the Cloudflare API.
## Subdomain Requirements
- Only **CNAME** records are allowed.
- The Cloudflare proxy is **enabled by default**, but can be disabled per subdomain.
- Reserved domains cannot be registered (e.g., `www.morlana.page`).
## How to Request a Subdomain
### 1. Edit `domains.yaml`
Add your subdomain under the `subdomains` section:
```yaml
subdomains:
- name: "your-subdomain"
target: "your-site.example.com"
proxy: true # Set to false if you want to disable the Cloudflare proxy
note: "Optional description"
```
### 2. Submit a Pull Request
- Ensure that your subdomain entry is in **alphabetical order**.
- Verify that your CNAME target is correct.
- Create a pull request with your changes.
## Reserved Domains
Some subdomains are **reserved** and cannot be registered. The list includes:
- `www.morlana.page`
- `api.morlana.page`
- `mail.morlana.page`
- Domains matching specific patterns (e.g., `admin.*`, `internal.*`).
## Automation
Once a pull request is merged, a GitHub Action will:
1. Validate the `domains.yaml` file.
2. Check for duplicate or reserved domains.
3. Update the Cloudflare DNS settings automatically.
## Setup for Maintainers
### Environment Variables
To enable Cloudflare DNS updates, set the following secrets in Gitea:
- `CLOUDFLARE_API_TOKEN`: API token with DNS write access.
- `CLOUDFLARE_ZONE_ID`: Cloudflare Zone ID for `morlana.page`.
## License
This project is open-source and licensed under the BSD-3-Clause.

View File

@@ -1,9 +1,12 @@
title: Morlana - Pages
description: >-
Free Subdomains provided by Morlana
baseurl: "/"
url: "https://morlana.page"
show_downloads: false
remote_theme: pages-themes/midnight@v0.2.0
plugins:
- jekyll-remote-theme

View File

@@ -4,8 +4,10 @@ reserved_domains:
- "^internal\\..*"
subdomains:
- name: sitiriotv
target: justin.morlana.space
- name: www
target: pages.morlana-pages.morlana.morlana.space
proxy: false
note: "Currently the cloudflare proxy service is not supported by Morlana Git Pages service"
# - name: "example"
# target: "example.com"
# proxy: true

View File

@@ -29,13 +29,22 @@ def get_existing_records():
def update_cloudflare():
data = load_domains()
reserved_patterns = data.get("reserved_domains", [])
subdomains = data.get("subdomains", [])
subdomains = {f"{sub['name']}.morlana.page": sub for sub in data.get("subdomains", [])}
existing_records = get_existing_records()
for subdomain in subdomains:
full_domain = f"{subdomain['name']}.morlana.page"
# Entferne Einträge, die nicht mehr in domains.yaml stehen
for existing_domain in existing_records:
if existing_domain.endswith(".morlana.page") and existing_domain not in subdomains:
record_id = existing_records[existing_domain]["id"]
response = requests.delete(f"{CLOUDFLARE_API_URL}/{record_id}", headers=HEADERS)
if response.status_code == 200:
print(f"Successfully removed {existing_domain}")
else:
print(f"Failed to remove {existing_domain}: {response.text}")
# Neue Einträge hinzufügen oder bestehende aktualisieren
for full_domain, subdomain in subdomains.items():
if is_reserved(full_domain, reserved_patterns):
print(f"Skipping reserved domain: {full_domain}")
continue