Skip to content

Commit

Permalink
Merge pull request #11 from FriendsOfREDAXO/next
Browse files Browse the repository at this point in the history
NEXT
  • Loading branch information
schuer authored Dec 28, 2023
2 parents 96796d6 + 78cf07d commit 96ddfb0
Show file tree
Hide file tree
Showing 31 changed files with 514 additions and 170 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Editor configuration, see https://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
max_line_length = off
trim_trailing_whitespace = false
20 changes: 0 additions & 20 deletions .github/workflows/dockerpush.yml

This file was deleted.

49 changes: 49 additions & 0 deletions .github/workflows/generate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Generate

on:
pull_request:
paths:
- "source/**/*"

concurrency:
# Cancel in-progress jobs if a new job is trigged by a commit from the same branch
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
generate:
name: Generate image files from source
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
# Ref is required if auto-commit action is used in pull requests.
# https://github.com/stefanzweifel/git-auto-commit-action#checkout-the-correct-branch
ref: ${{ github.head_ref }}
# Token is required to trigger new workflow runs after auto-commit action.
# https://github.com/stefanzweifel/git-auto-commit-action#commits-made-by-this-action-do-not-trigger-new-workflow-runs
token: ${{ secrets.GH_WORKFLOW }}

- name: Setup Deno
# https://github.com/marketplace/actions/setup-deno
uses: denoland/setup-deno@v1
with:
deno-version: "^1"

- name: Run generator script
run: deno task start

- name: Auto-commit changed files
# Automatically commit files which have been changed during the workflow run and push changes back
# to remote repository.
# https://github.com/marketplace/actions/git-auto-commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "GenerRRRRR-ate image files from source!"
commit_user_name: "FriendsOfREDAXO-T"
commit_user_email: "[email protected]"
commit_author: "FriendsOfREDAXO-T <[email protected]>"
file_pattern: "images/**/*"
124 changes: 124 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: Publish

on:
push:
branches:
- "main"
paths:
- "images/**/*"
# add workflow dispatch to manually publish the current images
workflow_dispatch:

concurrency:
# Cancel in-progress jobs if a new job is trigged by a commit from the same branch
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
REGISTRY_IMAGE: friendsofredaxo/demo

jobs:
collect:
name: Collect images from directories
runs-on: ubuntu-latest
outputs:
IMAGES: ${{ steps.images.outputs.directories }}

steps:
- name: Checkout repository
# https://github.com/actions/checkout
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Collect images from directories
id: images
run: |
cd images
directories=$(tree -J -d -L 1 | jq -c '.[0].contents | map(.name)')
echo $directories
echo "directories=$directories" >> $GITHUB_OUTPUT
publish:
name: Publish
runs-on: ubuntu-latest
needs: [collect]

strategy:
fail-fast: false
matrix:
image: ${{ fromJson(needs.collect.outputs.IMAGES) }}

steps:
- name: Checkout repository
# https://github.com/marketplace/actions/checkout
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Create tag list for image
# We make use of yp (https://mikefarah.gitbook.io/yq/) to create a taglist from
# the image’s `tags.yml` file, where all given tags (like `5-stable`, `5-edge`) are
# combined with all image registries (like ghcr, Docker Hub).
run: |
taglist=$(yq 'map(
(
"${{ env.REGISTRY_IMAGE }}",
"ghcr.io/${{ env.REGISTRY_IMAGE }}"
)
+ ":" + .[]) | to_csv' ./images/${{ matrix.image }}/tags.yml)
echo "$taglist"
echo "TAGLIST=$taglist" >> $GITHUB_ENV
- name: Set up QEMU
# https://github.com/marketplace/actions/docker-setup-qemu
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
# https://github.com/marketplace/actions/docker-setup-buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
# https://github.com/marketplace/actions/docker-login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to GitHub Container Registry
# https://github.com/marketplace/actions/docker-login
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
# https://github.com/marketplace/actions/build-and-push-docker-images
uses: docker/build-push-action@v5
with:
context: ./images/${{ matrix.image }}
platforms: linux/amd64,linux/arm64
push: true
provenance: false
tags: ${{ env.TAGLIST }}

- name: Update repo description
# https://github.com/marketplace/actions/docker-hub-description
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: ${{ env.REGISTRY_IMAGE }}
short-description: ${{ github.event.repository.description }}
enable-url-completion: true

- name: Delete untagged containers from GitHub Container Registry
# https://github.com/marketplace/actions/delete-untagged-ghcr
uses: Chizkiyahu/delete-untagged-ghcr-action@v3
with:
token: ${{ secrets.GH_PACKAGES }}
untagged_only: true
owner_type: org
except_untagged_multiplatform: true
58 changes: 58 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Test

on:
pull_request:
paths:
- "images/**/*"

concurrency:
# Cancel in-progress jobs if a new job is trigged by a commit from the same branch
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
collect:
name: Collect images from directories
runs-on: ubuntu-latest
outputs:
IMAGES: ${{ steps.images.outputs.directories }}

steps:
- name: Checkout repository
# https://github.com/marketplace/actions/checkout
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Collect images from directories
id: images
run: |
cd images
directories=$(tree -J -d -L 1 | jq -c '.[0].contents | map(.name)')
echo $directories
echo "directories=$directories" >> $GITHUB_OUTPUT
test:
name: Test
runs-on: ubuntu-latest
needs: [collect]

strategy:
fail-fast: false
matrix:
image: ${{ fromJson(needs.collect.outputs.IMAGES) }}

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Build and push
# https://github.com/marketplace/actions/build-and-push-docker-images
uses: docker/build-push-action@v5
with:
context: ./images/${{ matrix.image }}
load: true
tags: ${{ matrix.image }}
1 change: 0 additions & 1 deletion .gitignore

This file was deleted.

5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"deno.enable": true,
"deno.unstable": true,
"deno.importMap": "deno.json"
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Friends Of REDAXO
Copyright (c) 2023 Friends Of REDAXO

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
5 changes: 5 additions & 0 deletions README-developers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Dokumentation für Entwickelnde

Dieses Projekt ist nahezu gleich aufgebaut wie [FriendsOfREDAXO/docker-redaxo](https://github.com/FriendsOfREDAXO/docker-redaxo). Um die Dokumentation nicht doppelt zu pflegen, gibt es an dieser Stelle nur einen Link dorthin:

**[README-developers.md](https://github.com/FriendsOfREDAXO/docker-redaxo/blob/main/README-developers.md)**
24 changes: 15 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
# Docker website demo images for REDAXO

A collection of website demos made with ❤️ and REDAXO.
A collection of website demos for [REDAXO](https://github.com/redaxo/redaxo/) CMS, developed and maintained by [Friends Of REDAXO](https://github.com/FriendsOfREDAXO).

![Screenshot](https://raw.githubusercontent.com/FriendsOfREDAXO/docker-demos/assets/docker-demos_01.jpg)

Images are published both on [Docker Hub](https://hub.docker.com/r/friendsofredaxo/demo) and on [GitHub Container Registry](https://github.com/FriendsOfREDAXO/docker-demos/pkgs/container/demo), so you can choose between:

- `friendsofredaxo/demo`
- `ghcr.io/friendsofredaxo/demo`


## Supported tags

* __`base`__
* **`base`**
This demo aims to primarily help beginners, and it demonstrates just _one_ way how to develop a website with REDAXO.
[https://github.com/FriendsOfREDAXO/demo_base/](https://github.com/FriendsOfREDAXO/demo_base/)
* __`onepage`__
* **`onepage`**
This demo demonstrates 3 ways how to build a onepage website: with modules, with articles, with categories. _(German)_
[https://github.com/FriendsOfREDAXO/demo_onepage/](https://github.com/FriendsOfREDAXO/demo_onepage/)
* __`community`__
* **`community`**
In this demo you can see how to use the community addOn to create a website where users can register and login to protected areas. _(German)_
[https://github.com/FriendsOfREDAXO/demo_community/](https://github.com/FriendsOfREDAXO/demo_community/)

Expand All @@ -29,7 +35,7 @@ A collection of website demos made with ❤️ and REDAXO.

### With [`docker-compose`](https://docs.docker.com/compose/reference/overview/)

Example for REDAXO base demo container with MySQL container:
Example for REDAXO base demo container with MariaDB container:

```yml
version: '3'
Expand All @@ -38,11 +44,11 @@ services:
redaxo:
image: friendsofredaxo/demo:base
ports:
- 20080:80
- 80:80
volumes:
- redaxo:/var/www/html
environment:
REDAXO_SERVER: http://localhost:20080
REDAXO_SERVER: http://localhost
REDAXO_SERVERNAME: 'My Website'
REDAXO_ERROR_EMAIL: [email protected]
REDAXO_LANG: en_gb
Expand All @@ -56,7 +62,7 @@ services:
REDAXO_ADMIN_PASSWORD: 'PunKisNOT!dead'

db:
image: mysql:8
image: mariadb:10.11
volumes:
- db:/var/lib/mysql
environment:
Expand All @@ -72,7 +78,7 @@ volumes:
## Recipes
🧁 See [recipes](https://github.com/FriendsOfREDAXO/docker-redaxo/tree/master/recipes) section within the REDAXO image repo for further examples!
🧁 See [recipes](https://github.com/FriendsOfREDAXO/docker-redaxo/tree/main/recipes) section for further examples!
## Need help?
Expand Down
16 changes: 0 additions & 16 deletions base/hooks/post_push

This file was deleted.

16 changes: 0 additions & 16 deletions community/hooks/post_push

This file was deleted.

Loading

0 comments on commit 96ddfb0

Please sign in to comment.