1
0
mirror of https://github.com/gilbN/theme.park.git synced 2024-11-09 04:32:36 +01:00

Merge pull request #342 from GilbN/develop

added TP_SCHEME env, build on master
This commit is contained in:
GilbN 2022-03-23 21:27:15 +01:00 committed by GitHub
commit 5bcf8e8653
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 18 deletions

View File

@ -3,9 +3,20 @@ on:
release: release:
types: types:
- released - released
workflow_dispatch:
inputs:
branch:
description: 'Select branch'
required: true
type: choice
options:
- master
- develop
push: push:
branches: branches:
- develop - develop
paths-ignore:
- '.github/**'
jobs: jobs:
push_to_ghcr_io: push_to_ghcr_io:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -27,12 +38,12 @@ jobs:
username: ${{ github.repository_owner }} username: ${{ github.repository_owner }}
password: ${{ secrets.GH_PAT }} password: ${{ secrets.GH_PAT }}
- name: build&push master - name: build&push master
if: ${{ github.event.release.target_commitish == 'live' }} if: ${{ github.event.release.target_commitish == 'master' || github.event.inputs.branch == 'master' }}
run: | run: |
docker build --build-arg TP_RELEASE=${{ steps.get_version.outputs.VERSION }} --build-arg BUILD_DATE=${{ steps.date_time.outputs.NOW }} --tag ghcr.io/gilbn/theme.park --tag ghcr.io/gilbn/theme.park:${{ steps.get_version.outputs.VERSION }} . docker build --build-arg TP_RELEASE=${{ steps.get_version.outputs.VERSION }} --build-arg BUILD_DATE=${{ steps.date_time.outputs.NOW }} --tag ghcr.io/gilbn/theme.park --tag ghcr.io/gilbn/theme.park:${{ steps.get_version.outputs.VERSION }} .
docker push --all-tags ghcr.io/gilbn/theme.park docker push --all-tags ghcr.io/gilbn/theme.park
- name: build&push develop - name: build&push develop
if: ${{ github.ref == 'refs/heads/develop' }} if: ${{ github.ref == 'refs/heads/develop' || github.event.inputs.branch == 'develop' }}
run: | run: |
docker build --build-arg TP_RELEASE=${{ steps.get_version.outputs.VERSION }} --build-arg BUILD_DATE=${{ steps.date_time.outputs.NOW }} --tag ghcr.io/gilbn/theme.park:develop . docker build --build-arg TP_RELEASE=${{ steps.get_version.outputs.VERSION }} --build-arg BUILD_DATE=${{ steps.date_time.outputs.NOW }} --tag ghcr.io/gilbn/theme.park:develop .
docker push --all-tags ghcr.io/gilbn/theme.park docker push --all-tags ghcr.io/gilbn/theme.park
@ -55,12 +66,12 @@ jobs:
username: ${{ secrets.DH_USER }} username: ${{ secrets.DH_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: build&push dh master - name: build&push dh master
if: ${{ github.event.release.target_commitish == 'live' }} if: ${{ github.event.release.target_commitish == 'master' || github.event.inputs.branch == 'master' }}
run: | run: |
docker build --build-arg TP_RELEASE=${{ steps.get_version.outputs.VERSION }} --build-arg BUILD_DATE=${{ steps.date_time.outputs.NOW }} --tag gilbn/theme.park --tag gilbn/theme.park:${{ steps.get_version.outputs.VERSION }} . docker build --build-arg TP_RELEASE=${{ steps.get_version.outputs.VERSION }} --build-arg BUILD_DATE=${{ steps.date_time.outputs.NOW }} --tag gilbn/theme.park --tag gilbn/theme.park:${{ steps.get_version.outputs.VERSION }} .
docker push --all-tags gilbn/theme.park docker push --all-tags gilbn/theme.park
- name: build&push dh develop - name: build&push dh develop
if: ${{ github.ref == 'refs/heads/develop' }} if: ${{ github.ref == 'refs/heads/develop' || github.event.inputs.branch == 'develop' }}
run: | run: |
docker build --build-arg TP_RELEASE=${{ steps.get_version.outputs.VERSION }} --build-arg BUILD_DATE=${{ steps.date_time.outputs.NOW }} --tag gilbn/theme.park:develop . docker build --build-arg TP_RELEASE=${{ steps.get_version.outputs.VERSION }} --build-arg BUILD_DATE=${{ steps.date_time.outputs.NOW }} --tag gilbn/theme.park:develop .
docker push --all-tags gilbn/theme.park docker push --all-tags gilbn/theme.park

View File

@ -9,8 +9,10 @@ server {
location / { location / {
sub_filter_types *; sub_filter_types *;
sub_filter 'https://theme-park.dev' $scheme://TP_DOMAIN; sub_filter 'https://theme-park.dev' $scheme://TP_DOMAIN;
sub_filter 'https://develop.theme-park.dev' $scheme://TP_DOMAIN; sub_filter 'http://theme-park.dev' $scheme://TP_DOMAIN;
sub_filter 'https://develop.theme-park.dev' $scheme://TP_DOMAIN;
sub_filter 'http://develop.theme-park.dev' $scheme://TP_DOMAIN;
sub_filter_once off; sub_filter_once off;
try_files $uri $uri/ /index.html; try_files $uri $uri/ /index.html;
} }

View File

@ -9,6 +9,7 @@ echo -e "Variables set:\\n\
PUID=${PUID}\\n\ PUID=${PUID}\\n\
PGID=${PGID}\\n\ PGID=${PGID}\\n\
TZ=${TZ}\\n\ TZ=${TZ}\\n\
TP_SCHEME=${TP_SCHEME}\\n\
TP_DOMAIN=${TP_DOMAIN}\\n" TP_DOMAIN=${TP_DOMAIN}\\n"
if [[ -z ${TP_DOMAIN} ]]; then if [[ -z ${TP_DOMAIN} ]]; then
@ -16,11 +17,8 @@ if [[ -z ${TP_DOMAIN} ]]; then
TP_DOMAIN='$http_host' TP_DOMAIN='$http_host'
fi fi
DEFAULT='/config/nginx/site-confs/default' sed -i "s/TP_DOMAIN;/${TP_DOMAIN}; /g" /defaults/default
if ! grep -q "sub_filter 'https://theme-park.dev' \$scheme://${TP_DOMAIN};" ${DEFAULT}; then cp /defaults/default /config/nginx/site-confs
sed -i "s/sub_filter 'https:\/\/theme-park.dev' \$scheme:\/\/TP_DOMAIN;/sub_filter 'https:\/\/theme-park.dev' \$scheme:\/\/${TP_DOMAIN}; /g" ${DEFAULT}
sed -i "s/sub_filter 'https:\/\/develop.theme-park.dev' \$scheme:\/\/TP_DOMAIN;/sub_filter 'https:\/\/develop.theme-park.dev' \$scheme:\/\/${TP_DOMAIN}; /g" ${DEFAULT}
fi
# make our folders and links # make our folders and links
mkdir -p \ mkdir -p \

View File

@ -38,12 +38,12 @@ def create_addons_json():
f"{addon_root}/{app}/{addon}") if isfile(join(f"{addon_root}/{app}/{addon}", file))] f"{addon_root}/{app}/{addon}") if isfile(join(f"{addon_root}/{app}/{addon}", file))]
if len([f for f in files if f.endswith('.css')]) > 1: if len([f for f in files if f.endswith('.css')]) > 1:
ADDONS["addons"][app][addon].update({ ADDONS["addons"][app][addon].update({
"css": [f"https://{DOMAIN}/css/addons/{app}/{addon}/{file}?sha={SHAS.get(file)}" for file in files if file.split(".")[1] == "css"] "css": [f"{scheme}://{DOMAIN}/css/addons/{app}/{addon}/{file}?sha={SHAS.get(file)}" for file in files if file.split(".")[1] == "css"]
} }
) )
else: else:
ADDONS["addons"][app].update({ ADDONS["addons"][app].update({
addon: f"https://{DOMAIN}/css/addons/{app}/{addon}/{file}?sha={SHAS.get(file)}" for file in files if file.split(".")[1] == "css" addon: f"{scheme}://{DOMAIN}/css/addons/{app}/{addon}/{file}?sha={SHAS.get(file)}" for file in files if file.split(".")[1] == "css"
} }
) )
extra_dirs = [dir for dir in listdir( extra_dirs = [dir for dir in listdir(
@ -54,7 +54,7 @@ def create_addons_json():
f"{addon_root}/{app}/{addon}/{dir}") if isfile(join(f"{addon_root}/{app}/{addon}/{dir}", file))] f"{addon_root}/{app}/{addon}/{dir}") if isfile(join(f"{addon_root}/{app}/{addon}/{dir}", file))]
ADDONS["addons"][app][addon].update({ ADDONS["addons"][app][addon].update({
dir: { dir: {
"css": [f"https://{DOMAIN}/css/addons/{app}/{addon}/{dir}/{extra_file}?sha={SHAS.get(extra_file)}" for extra_file in extra_dir_files if extra_file.split(".")[1] == "css"] "css": [f"{scheme}://{DOMAIN}/css/addons/{app}/{addon}/{dir}/{extra_file}?sha={SHAS.get(extra_file)}" for extra_file in extra_dir_files if extra_file.split(".")[1] == "css"]
} }
} }
) )
@ -70,12 +70,12 @@ def create_json(app_folders: list = None, themes: list = None, community_themes:
COMMUNITY_THEME_SHAS = get_shas(community_theme_shas) COMMUNITY_THEME_SHAS = get_shas(community_theme_shas)
THEMES = { THEMES = {
theme.split(".")[0].capitalize(): { theme.split(".")[0].capitalize(): {
"url": f"https://{DOMAIN}/css/theme-options/{theme}?sha={THEME_SHAS.get(theme)}" "url": f"{scheme}://{DOMAIN}/css/theme-options/{theme}?sha={THEME_SHAS.get(theme)}"
}for theme in themes }for theme in themes
} }
COMMUNITY_THEMES = { COMMUNITY_THEMES = {
theme.split(".")[0].capitalize(): { theme.split(".")[0].capitalize(): {
"url": f"https://{DOMAIN}/css/community-theme-options/{theme}?sha={COMMUNITY_THEME_SHAS.get(theme)}" "url": f"{scheme}://{DOMAIN}/css/community-theme-options/{theme}?sha={COMMUNITY_THEME_SHAS.get(theme)}"
}for theme in community_themes }for theme in community_themes
} }
THEMES_DICT.update(dict(sorted({ THEMES_DICT.update(dict(sorted({
@ -98,7 +98,7 @@ def create_json(app_folders: list = None, themes: list = None, community_themes:
APPS.update(dict(sorted({ APPS.update(dict(sorted({
"applications": { "applications": {
app: { app: {
"base_css": f"https://{DOMAIN}/css/base/{app}/{app}-base.css?sha={SHAS.get(f'{app}-base.css')}", "base_css": f"{scheme}://{DOMAIN}/css/base/{app}/{app}-base.css?sha={SHAS.get(f'{app}-base.css')}",
"addons": ADDONS["addons"][app] if app in ADDONS["addons"] else {} "addons": ADDONS["addons"][app] if app in ADDONS["addons"] else {}
} for app in app_folders if not isfile(f'./css/base/{app}/.deprecated') } for app in app_folders if not isfile(f'./css/base/{app}/.deprecated')
} }
@ -106,7 +106,7 @@ def create_json(app_folders: list = None, themes: list = None, community_themes:
APPS.update(dict(sorted({ APPS.update(dict(sorted({
"deprecated": { "deprecated": {
app: { app: {
"base_css": f"https://{DOMAIN}/css/base/{app}/{app}-base.css?sha={SHAS.get(f'{app}-base.css')}", "base_css": f"{scheme}://{DOMAIN}/css/base/{app}/{app}-base.css?sha={SHAS.get(f'{app}-base.css')}",
"addons": ADDONS["addons"][app] if app in ADDONS["addons"] else {} "addons": ADDONS["addons"][app] if app in ADDONS["addons"] else {}
} for app in app_folders if isfile(f'./css/base/{app}/.deprecated') } for app in app_folders if isfile(f'./css/base/{app}/.deprecated')
} }
@ -132,6 +132,7 @@ def create_theme_options():
create_css(folder) create_css(folder)
env_domain = env.get('TP_DOMAIN') env_domain = env.get('TP_DOMAIN')
scheme = env.get('TP_SCHEME','https')
if __name__ == "__main__": if __name__ == "__main__":
app_folders = [name for name in listdir('./css/base') if isdir(join('./css/base', name))] app_folders = [name for name in listdir('./css/base') if isdir(join('./css/base', name))]