-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NEW scaffolding & var-replacement workflow for the use as a template-…
…repo (97,2% clone from crud-the-docs-playground)
- Loading branch information
1 parent
9168e2e
commit ac6ca34
Showing
8 changed files
with
161 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env bash | ||
while getopts a:n:u:d: flag | ||
do | ||
case "${flag}" in | ||
a) author=${OPTARG};; | ||
n) name=${OPTARG};; | ||
u) urlname=${OPTARG};; | ||
d) description=${OPTARG};; | ||
esac | ||
done | ||
|
||
echo "Author: $author"; | ||
echo "Project Name: $name"; | ||
echo "Project URL name: $urlname"; | ||
echo "Description: $description"; | ||
|
||
echo "Renaming project..." | ||
|
||
original_author="author_name" | ||
original_name="project_name" | ||
original_urlname="project_urlname" | ||
original_description="project_description" | ||
# for filename in $(find . -name "*.*") | ||
for filename in $(git ls-files) | ||
do | ||
sed -i "s/$original_author/$author/g" $filename | ||
sed -i "s/$original_name/$name/g" $filename | ||
sed -i "s/$original_urlname/$urlname/g" $filename | ||
sed -i "s/$original_description/$description/g" $filename | ||
echo "Renamed $filename" | ||
done | ||
|
||
mv project_name $name | ||
|
||
# This command runs only once on GHA! | ||
rm -rf .github/template.yml | ||
rm -rf .github/workflows/rename_project.yml | ||
rm -rf copy/workflows/rename_project.yml | ||
rm -rf .github/rename_project.sh | ||
|
||
rm -rf README.md | ||
mv README.tmpl.md README.md | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
author: GatherPress |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, '/gatherpress-awesome') }} | ||
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 "${{ env.REPOSITORY_NAME }} is Awesome for GatherPress." | ||
- uses: stefanzweifel/git-auto-commit-action@v5 | ||
with: | ||
commit_message: "✅ Ready to get Awesome." | ||
push_options: --force |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
{ | ||
"step": "setSiteOptions", | ||
"options": { | ||
"blogname": "GatherPress Awesome", | ||
"blogname": "GatherPress project_name", | ||
"blogdescription": "Powering Communities with WordPress.", | ||
"users_can_register": 1, | ||
"permalink_structure": "/%year%/%monthnum%/%postname%/" | ||
|
@@ -31,6 +31,13 @@ | |
"step": "runPHP", | ||
"code": "<?php require '/wordpress/wp-load.php'; $user_id = wp_create_user('editor', 'editorpass', '[email protected]'); (new WP_User($user_id))->set_role('editor');" | ||
}, | ||
{ | ||
"step": "updateUserMeta", | ||
"meta": { | ||
"admin_color": "modern" | ||
}, | ||
"userId": 1 | ||
}, | ||
{ | ||
"step": "login", | ||
"username": "admin", | ||
|
@@ -50,7 +57,7 @@ | |
"step": "installPlugin", | ||
"pluginZipFile": { | ||
"resource": "url", | ||
"url": "https://github-proxy.com/proxy/?repo=GatherPress/gatherpress-awesome" | ||
"url": "https://github-proxy.com/proxy/?repo=author_name/project_urlname" | ||
}, | ||
"options": { | ||
"activate": true | ||
|
@@ -60,7 +67,7 @@ | |
"step": "importWxr", | ||
"file": { | ||
"resource": "url", | ||
"url": "https://raw.githubusercontent.com/carstingaxion/gatherpress-demo-data/main/GatherPress-demo-data-2024.xml" | ||
"url": "https://raw.githubusercontent.com/GatherPress/demo-data/main/GatherPress-demo-data-2024.xml" | ||
} | ||
} | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# GatherPress project_name | ||
|
||
A starter plugin for GatherPress companion plugin development. | ||
|
||
## Already prepared for your GatherPress project_name plugin | ||
|
||
- [x] Test [GatherPress project_name in Playground](https://playground.wordpress.net/builder/builder.html?blueprint-url=https://raw.githubusercontent.com/author_name/project_urlname/main/.wordpress-org/blueprints/blueprint.json), with GatherPress installed & project_name already in place. | ||
|
||
### Up to you | ||
|
||
- [ ] [Create your own GatherPress project_name demo-data](https://github.com/carstingaxion/crud-the-docs-playground), and add it to your [`blueprint.json`](/.wordpress-org/blueprints/blueprint.json). | ||
|
||
|
||
## You should create a new repository from [the original template](https://github.com/new?template_name=gatherpress-awesome&template_owner=GatherPress) for yourself, too, if you'd like to ... | ||
|
||
- **collaboratively work** on a compagnion-plugin for GatherPress | ||
|
||
- extend GatherPress' standard **scenarios using your plugin or theme** | ||
|
||
- see how GatherPress works & test its extendebility. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters