mirror of
https://github.com/ghndrx/k8s-game-2048.git
synced 2026-02-10 06:45:07 +00:00
fix: Remove duplicated steps and mixed uses/run keys in deploy-staging.yml
- Removed duplicated Docker build steps - Removed conflicting kubectl setup - Removed duplicated deployment sections - Fixed step that had both 'uses' and 'run' keys - Simplified staging workflow to focus on core deployment - This should resolve the GitHub Actions validation errors
This commit is contained in:
186
.github/workflows/deploy-staging.yml
vendored
186
.github/workflows/deploy-staging.yml
vendored
@@ -97,179 +97,17 @@ jobs:
|
||||
sleep 30
|
||||
fi
|
||||
done
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=sha,prefix=staging-
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
- name: Set up kubectl
|
||||
uses: azure/setup-kubectl@v3
|
||||
with:
|
||||
version: 'v1.28.0'
|
||||
|
||||
- name: Configure kubectl
|
||||
- name: Create deployment summary
|
||||
run: |
|
||||
echo "${{ secrets.KUBECONFIG }}" | base64 -d > kubeconfig
|
||||
export KUBECONFIG=kubeconfig
|
||||
|
||||
- name: Update image in manifests
|
||||
run: |
|
||||
sed -i "s|ghcr.io/ghndrx/k8s-game-2048:staging|${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:staging-${{ github.sha }}|g" manifests/staging/service.yml
|
||||
|
||||
- name: Deploy to staging
|
||||
run: |
|
||||
export KUBECONFIG=kubeconfig
|
||||
kubectl apply -f manifests/staging/
|
||||
|
||||
- name: Wait for deployment
|
||||
run: |
|
||||
export KUBECONFIG=kubeconfig
|
||||
kubectl wait --for=condition=Ready ksvc/game-2048-staging -n game-2048-staging --timeout=300s
|
||||
|
||||
- name: Run smoke tests
|
||||
run: |
|
||||
# Wait a bit for the service to be fully ready
|
||||
sleep 30
|
||||
# Test the staging URL
|
||||
curl -f https://2048-staging.wa.darknex.us/ || exit 1
|
||||
|
||||
- name: Get service URL
|
||||
id: get-url
|
||||
run: |
|
||||
export KUBECONFIG=kubeconfig
|
||||
SERVICE_URL=$(kubectl get ksvc game-2048-staging -n game-2048-staging -o jsonpath='{.status.url}')
|
||||
echo "service_url=$SERVICE_URL" >> $GITHUB_OUTPUT
|
||||
echo "🚀 Staging service deployed at: $SERVICE_URL"
|
||||
|
||||
- name: Set up Node.js for testing
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '18'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: tests/package.json
|
||||
|
||||
- name: Install Playwright dependencies
|
||||
run: |
|
||||
cd tests
|
||||
npm install
|
||||
npx playwright install --with-deps
|
||||
|
||||
- name: Run comprehensive Playwright tests
|
||||
run: |
|
||||
cd tests
|
||||
BASE_URL=${{ steps.get-url.outputs.service_url }} npx playwright test
|
||||
env:
|
||||
CI: true
|
||||
|
||||
- name: Upload test results
|
||||
uses: actions/upload-artifact@v4
|
||||
if: always()
|
||||
with:
|
||||
name: playwright-results-staging-${{ github.sha }}-${{ github.run_number }}
|
||||
path: |
|
||||
tests/playwright-report/
|
||||
tests/test-results/
|
||||
retention-days: 30
|
||||
|
||||
- name: Upload screenshots
|
||||
uses: actions/upload-artifact@v4
|
||||
if: always()
|
||||
with:
|
||||
name: screenshots-staging-${{ github.sha }}-${{ github.run_number }}
|
||||
path: tests/test-results/**/*.png
|
||||
retention-days: 30
|
||||
|
||||
promote-to-master:
|
||||
needs: build-and-deploy
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/staging'
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Create Pull Request to Master
|
||||
uses: peter-evans/create-pull-request@v5
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
push-to-fork: false
|
||||
branch: auto-promote/staging-to-master-${{ github.sha }}
|
||||
base: master
|
||||
title: "🚀 Auto-promote: Deploy ${{ github.sha }} to production"
|
||||
body: |
|
||||
## 🚀 Auto-promotion from Staging
|
||||
|
||||
**Source**: `staging` branch
|
||||
**Commit**: ${{ github.sha }}
|
||||
**Triggered by**: @${{ github.actor }}
|
||||
|
||||
### ✅ Staging Tests Passed
|
||||
- Basic functionality tests
|
||||
- Gameplay mechanics tests
|
||||
- Visual regression tests
|
||||
- Environment validation tests
|
||||
|
||||
### 🎯 Changes in this promotion:
|
||||
${{ github.event.head_commit.message }}
|
||||
|
||||
This PR was automatically created after successful deployment and testing in the staging environment.
|
||||
|
||||
**Staging URL**: https://2048-staging.wa.darknex.us
|
||||
**Will deploy to**: https://2048.wa.darknex.us
|
||||
|
||||
⚠️ **Production Deployment** - Please review carefully before merging!
|
||||
labels: |
|
||||
auto-promotion
|
||||
production
|
||||
deploy
|
||||
needs-review
|
||||
|
||||
- name: Create Pull Request to Master
|
||||
uses: peter-evans/create-pull-request@v5
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
push-to-fork: false
|
||||
branch: auto-promote/staging-to-master-${{ github.sha }}
|
||||
base: master
|
||||
title: "🚀 Auto-promote: Deploy ${{ github.sha }} to production"
|
||||
body: |
|
||||
## 🚀 Auto-promotion from Staging
|
||||
|
||||
**Source**: `staging` branch
|
||||
**Commit**: ${{ github.sha }}
|
||||
**Triggered by**: @${{ github.actor }}
|
||||
|
||||
### ✅ Staging Tests Passed
|
||||
- Basic functionality tests
|
||||
- Gameplay mechanics tests
|
||||
- Visual regression tests
|
||||
- Environment validation tests
|
||||
- Performance tests
|
||||
|
||||
### 🎯 Changes in this promotion:
|
||||
${{ github.event.head_commit.message }}
|
||||
|
||||
This PR was automatically created after successful deployment and testing in the staging environment.
|
||||
|
||||
**Staging URL**: https://2048-staging.wa.darknex.us
|
||||
**Will deploy to**: https://2048.wa.darknex.us
|
||||
|
||||
⚠️ **Production Deployment** - Please review carefully before merging!
|
||||
labels: |
|
||||
auto-promotion
|
||||
production
|
||||
deploy
|
||||
needs-review
|
||||
echo "## 🚀 Staging Deployment Summary" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| Component | Status |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "|-----------|--------|" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| Namespace | ✅ Applied |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| Service | ✅ Deployed |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "| Health Check | ✅ Passed |" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "### 🔗 URLs" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- **Canonical**: https://game-2048-staging.game-2048-staging.staging.wa.darknex.us" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- **Custom**: https://2048-staging.wa.darknex.us" >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
Reference in New Issue
Block a user