Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
carstingaxion committed Jun 12, 2024
1 parent ab1921b commit 1413353
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 3 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/rename_project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Rename the project from template

on: [push]

permissions: write-all

jobs:
rename-project:
if: ${{ !contains (github.repository, '/crud-the-docs-playground') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# by default, it uses a depth of 1
# this fetches all history so that we can read each commit
fetch-depth: 0
ref: ${{ github.head_ref }}

- run: echo "REPOSITORY_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}' | tr '-' '_' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
shell: bash

- run: echo "REPOSITORY_URLNAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_ENV
shell: bash

- run: echo "REPOSITORY_OWNER=$(echo '${{ github.repository }}' | awk -F '/' '{print $1}')" >> $GITHUB_ENV
shell: bash

- name: Is this still a template
id: is_template
run: echo "::set-output name=is_template::$(ls .github/template.yml &> /dev/null && echo true || echo false)"

- name: Rename the project
if: steps.is_template.outputs.is_template == 'true'
run: |
echo "Renaming the project with -a(author) ${{ env.REPOSITORY_OWNER }} -n(name) ${{ env.REPOSITORY_NAME }} -u(urlname) ${{ env.REPOSITORY_URLNAME }}"
.github/rename_project.sh -a ${{ env.REPOSITORY_OWNER }} -n ${{ env.REPOSITORY_NAME }} -u ${{ env.REPOSITORY_URLNAME }} -d "CRUD the ${{ env.REPOSITORY_NAME }} in Playground."
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "✅ Ready to CRUD the ${{ env.REPOSITORY_NAME }} in Playground."
push_options: --force
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ https://github.com/carstingaxion/gatherpress-demo-data/assets/198883/79c19cab-24

- [Create, read update, delete & save][export-to-github] the demo-data using Playground and persist it with prepared settings for GitHub Export.
- or simply browse & view ...
- [the `docs` with *Twentytwentyfour*](https://playground.wordpress.net/?login=yes&import-wxr=https://raw.githubusercontent.com/carstingaxion/crud-the-docs-playground/main/export.xml).
- [the `docs` with *Disco*](https://playground.wordpress.net/?login=yes&import-wxr=https://raw.githubusercontent.com/carstingaxion/crud-the-docs-playground/main/export.xml&theme=disco).
- [the `docs` with *Twentytwentyfour*](https://playground.wordpress.net/?url=/?p=173&login=yes&import-wxr=https://raw.githubusercontent.com/carstingaxion/crud-the-docs-playground/main/export.xml).
- [the `docs` with *Disco*](https://playground.wordpress.net/?url=/?p=173&login=yes&import-wxr=https://raw.githubusercontent.com/carstingaxion/crud-the-docs-playground/main/export.xml&theme=disco).

## How

Expand Down
61 changes: 61 additions & 0 deletions README.tmpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# CRUD the `project_name` with Playground

https://github.com/author_name/gatherpress-demo-data/assets/198883/79c19cab-24f0-47e8-9710-832aed7938ca


# What

- [Create, read update, delete & save][export-to-github] the demo-data using Playground and persist it with prepared settings for GitHub Export.
- or simply browse & view ...
- [the `docs` with *Twentytwentyfour*](https://playground.wordpress.net/?url=/?p=173&login=yes&import-wxr=https://raw.githubusercontent.com/author_name/project_urlname/main/export.xml).
- [the `docs` with *Disco*](https://playground.wordpress.net/?url=/?p=173&login=yes&import-wxr=https://raw.githubusercontent.com/author_name/project_urlname/main/export.xml&theme=disco).

## How

- The `blueprint.json` files is made & validated using the playground-based [blueprint builder][builder]
- Images ...
- Export to xml ...

### *Settings*

```json
{
"step": "setSiteOptions",
"options": {
"blogname": "Books",
"blogdescription": "CRUD the Books in Playground.",
"wordpress_export_to_server__file": "books.xml",
"wordpress_export_to_server__owner_repo_branch": "author_name/example-books/main",
"wordpress_export_to_server__export_home": "https://example.test/books"
}
}
```

# Why

> Idea for the [WCEU Contributor day](https://gatherpress.org/event/hybrid-event-wceu2024-contributor-day/):
>
> Create a demo of your special use case with GatherPress & Playground!
> And let's grow a collection like the blueprint-galleries.
>
> https://gatherpress.slack.com/archives/CNZS6PPFZ/p1717928500570539
## Based on & wouldn't work without

- the Export to GitHub feature of WordPress Playground
- and a small, custom plugin, that saves a regular export.xml to the file system, instead of downloading it to the user.

## Inspired by

- [adamziel/playground-docs-workflow: Experimenting with maintaining WordPress docs using WordPress Playground](https://github.com/adamziel/playground-docs-workflow)
- and [bgrgicak/playground-blog: A built using WordPress Playground](https://github.com/bgrgicak/playground-blog)

## Ressources

- [How to add demo content in WordPress](https://learn.wordpress.org/lesson-plan/how-to-add-demo-content-in-wordpress/) - Learn WordPress


[builder]: https://playground.wordpress.net/builder/builder.html?blueprint-url=https://raw.githubusercontent.com/author_name/project_urlname/main/blueprints/blueprint.json


[export-to-github]: https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/author_name/project_urlname/main/blueprints/blueprint.json&gh-ensure-auth=yes&ghexport-repo-url=https://github.com/author_name/project_urlname&ghexport-pr-action=create&ghexport-playground-root=/wordpress/wp-content/project_urlname-main&ghexport-repo-root=/&ghexport-path=.&ghexport-content-type=custom-paths&ghexport-commit-message=Changes%20from%20Playground&ghexport-allow-include-zip=no
2 changes: 1 addition & 1 deletion export.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<!-- wp:buttons -->
<div class="wp-block-buttons"><!-- wp:button -->
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button">Create &amp; Save Demo Data</a></div>
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button" href="https://github.com/carstingaxion/crud-the-docs-playground">Create &amp; Save Demo Data</a></div>
<!-- /wp:button --></div>
<!-- /wp:buttons -->
Expand Down

0 comments on commit 1413353

Please sign in to comment.