51 أسطر
1.7 KiB
Markdown
51 أسطر
1.7 KiB
Markdown
# Ghaymah CI/CD Guide
|
|
|
|
## Staging vs. Production
|
|
|
|
- Staging is a pre-production environment used to test changes safely before they reach real users. It is typically isolated from production data and traffic, so teams can validate deployments, configuration, and application behavior without affecting live services.
|
|
- Production is the live environment that serves real users and business-critical traffic. Deployments here should be controlled carefully, usually with approval gates, protected environments, and rollback plans.
|
|
- A common release flow is:
|
|
1. Build and test the application.
|
|
2. Deploy to staging.
|
|
3. Validate the release.
|
|
4. Request approval for production.
|
|
5. Deploy to production.
|
|
|
|
## Connecting the GitHub Actions workflow to Ghaymah CLI
|
|
|
|
The workflow uses the Ghaymah CLI to authenticate and deploy the app.
|
|
|
|
### 1. Add GitHub secrets
|
|
Create these repository or environment secrets in GitHub:
|
|
|
|
- GHAYMAH_EMAIL
|
|
- GHAYMAH_PW
|
|
|
|
### 2. Install the CLI
|
|
The workflow installs the CLI during the deployment job:
|
|
|
|
```bash
|
|
curl -sSL https://cli.ghaymah.systems/install.sh | bash
|
|
```
|
|
|
|
### 3. Authenticate with Ghaymah
|
|
After installation, the workflow logs in with the stored credentials:
|
|
|
|
```bash
|
|
$HOME/ghaymah/bin/gy auth login --email "${{ secrets.GHAYMAH_EMAIL }}" --password "${{ secrets.GHAYMAH_PW }}" --debug
|
|
```
|
|
|
|
### 4. Deploy the application
|
|
The deployment step then launches the app through Ghaymah:
|
|
|
|
```bash
|
|
$HOME/ghaymah/bin/gy resource app launch --debug
|
|
```
|
|
|
|
### 5. Recommended GitHub environment setup
|
|
Use GitHub Environments for deployment control:
|
|
|
|
- Create a staging environment for regular validation.
|
|
- Create a production environment and require manual approval before deployment.
|
|
- Attach the same secrets to the relevant environment when needed.
|