Create create-app-structure.yml #1
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
name: Create App Structure | |
# Trigger the action on push or pull_request to the main branch | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
create-structure: | |
runs-on: ubuntu-latest | |
# Explicit permissions for the workflow to write to the repository | |
permissions: | |
contents: write | |
actions: read | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install tree command | |
run: sudo apt-get install -y tree | |
- name: Create app directories and files | |
run: | | |
# Create directories | |
mkdir -p app/{config,modules,protected/runtime,static,protected/vendor} | |
# Create basic configuration files | |
touch app/.env app/config/db.php app/config/web.php | |
# Create basic module and protected files | |
mkdir -p app/modules/custom_module | |
touch app/modules/custom_module/Module.php | |
mkdir -p app/protected/controllers | |
touch app/protected/controllers/IndexController.php | |
mkdir -p app/protected/models | |
touch app/protected/models/User.php | |
mkdir -p app/protected/views/site | |
touch app/protected/views/site/index.php | |
# Create static directories for assets | |
mkdir -p app/static/css app/static/js app/static/images | |
# Create vendor file (it will be populated later by Composer) | |
touch app/protected/vendor/.gitkeep | |
# Output structure for confirmation | |
echo "App structure created successfully" | |
tree app/ | |
- name: Commit and push changes (if any) | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "actions@github.com" | |
git add app/ | |
git commit -m "Create initial app structure" || echo "No changes to commit" | |
git push origin main |