Multi-Environment Deployment #2
This file contains hidden or 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: Multi-Environment Deployment | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| environment: | |
| description: "Choose environment to deploy" | |
| required: true | |
| default: "dev" | |
| jobs: | |
| deploy: | |
| name: 🚀 Deploy Application | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: ${{ github.event.inputs.environment }} | |
| url: https://myapp-${{ github.event.inputs.environment }}.example.com | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Print environment info | |
| run: | | |
| echo "Deploying to environment: ${{ github.event.inputs.environment }}" | |
| echo "Triggered by: ${{ github.actor }}" | |
| - name: Use environment secret | |
| env: | |
| API_KEY: ${{ secrets.API_KEY }} | |
| run: | | |
| echo "Using secret (masked): ${API_KEY:0:4}****" | |
| echo "Environment URL: https://myapp-${{ github.event.inputs.environment }}.example.com" | |
| - name: Simulate deployment | |
| run: | | |
| echo "🚀 Deploying app to ${{ github.event.inputs.environment }}..." | |
| sleep 3 | |
| echo "✅ Deployment successful!" |