Skip to content

Commit

Permalink
Update repository structure and documentation
Browse files Browse the repository at this point in the history
- Remove main branch references
- Update deployment documentation
- Clean up feature branches
- Simplify branching strategy to staging/production
  • Loading branch information
screenfluent committed Nov 18, 2024
1 parent 0b381a8 commit 9f66758
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 44 deletions.
27 changes: 13 additions & 14 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,20 @@ name: Deploy

on:
push:
branches: [ main, production ]
branches: [ staging, production ]

jobs:
lint:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'

- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: Check PHP syntax
run: find . -type f -name '*.php' -print0 | xargs -0 -n1 php -l
- uses: actions/checkout@v2

- name: Deploy to Forge
env:
FORGE_API_TOKEN: ${{ secrets.FORGE_API_TOKEN }}
run: |
if [[ $GITHUB_REF == "refs/heads/production" ]]; then
curl -X POST ${{ secrets.FORGE_PRODUCTION_DEPLOY_URL }}
elif [[ $GITHUB_REF == "refs/heads/staging" ]]; then
curl -X POST ${{ secrets.FORGE_STAGING_DEPLOY_URL }}
fi
14 changes: 7 additions & 7 deletions DEPLOYMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

## Local Development

1. Make sure you're on main branch:
1. Make sure you're on staging branch:
```bash
git checkout main
git pull origin main
git checkout staging
git pull origin staging
```

2. Make changes and test locally:
Expand All @@ -17,7 +17,7 @@ git pull origin main
```bash
git add .
git commit -m "Descriptive message"
git push origin main
git push origin staging
```

## Staging Deployment
Expand All @@ -36,7 +36,7 @@ git push origin main
After verifying on staging:
```bash
git checkout production
git merge main
git merge staging
git push origin production
```

Expand Down Expand Up @@ -88,7 +88,7 @@ git revert HEAD
# or
git reset --hard HEAD^

git push origin main --force
git push origin staging --force
```

2. Production Rollback:
Expand All @@ -103,7 +103,7 @@ git push origin production --force
# Get file from previous commit
git checkout HEAD^ -- path/to/file
git commit -m "Rollback file to previous version"
git push origin main # for staging
git push origin staging # for staging
# or
git push origin production # for production
```
Expand Down
42 changes: 22 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,40 +28,42 @@ php db/init.php

## Deployment

The site uses Laravel Forge for deployment. The deployment process is:
1. Push changes to the `staging` branch for testing
2. Once tested, merge to `production` branch for production deployment

1. Push changes to the `main` branch for staging
2. Push changes to the `production` branch for live site
## Branches

### Branch Strategy
- `staging`: Development branch, deploys to staging
- `production`: Production branch, deploys to production

- `main`: Development branch, deploys to staging
- `production`: Production branch, deploys to live site
- `feature/*`: Feature branches
- `fix/*`: Bug fix branches
## Development Workflow

### Deployment Process

1. Create feature branch:
1. Clone the repository and checkout staging branch:
```bash
git checkout main
git pull origin main
git checkout -b feature/your-feature
git clone https://github.com/screenfluent/llmstxtdirectory.git
cd llmstxtdirectory
git checkout staging
git pull origin staging
```

2. Make changes and test locally
2. Make your changes and commit them:
```bash
git add .
git commit -m "Your commit message"
```

3. Push to staging:
```bash
git checkout main
git merge feature/your-feature
git push origin main
git checkout staging
git pull origin staging
git push origin staging
```

4. After testing on staging, deploy to production:
4. After testing on staging, merge to production:
```bash
git checkout production
git merge main
git pull origin production
git merge staging
git push origin production
```

Expand Down
2 changes: 1 addition & 1 deletion deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
php artisan down || true

# Pull the latest changes from the git repository
git pull origin main
git pull origin staging

# Install/update composer dependencies
composer install --no-interaction --prefer-dist --optimize-autoloader
Expand Down
4 changes: 2 additions & 2 deletions forge/deploy.staging.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ cd /home/stagingllmstxtdirectory/staging.llmstxt.directory

# Initial git setup
git fetch --all
git checkout -f staging || git checkout -f main
git pull origin staging || git pull origin main
git checkout -f staging
git pull origin staging

# Set permissions
chown -R stagingllmstxtdirectory:stagingllmstxtdirectory .
Expand Down

0 comments on commit 9f66758

Please sign in to comment.