Skip to content

Commit 9fa19ad

Browse files
committed
Adds Azure publish profile deployment workflow
Offers an alternative authentication method for Azure deployment Adds production environment variables to facilitate configuration Introduces a setup guide to streamline the overall deployment process
1 parent e2b7930 commit 9fa19ad

File tree

3 files changed

+134
-0
lines changed

3 files changed

+134
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Deploy to Azure App Service (Publish Profile)
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Build and Push Docker Image"]
6+
types:
7+
- completed
8+
branches: [ main ]
9+
10+
# Allow manual trigger
11+
workflow_dispatch:
12+
13+
env:
14+
AZURE_WEBAPP_NAME: 'your-app-name' # Replace with your App Service name
15+
REGISTRY: ghcr.io
16+
IMAGE_NAME: ${{ github.repository }}/app-scripting-editor
17+
18+
jobs:
19+
deploy:
20+
runs-on: ubuntu-latest
21+
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
22+
23+
environment:
24+
name: 'production'
25+
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
26+
27+
steps:
28+
- name: Lowercase repository name
29+
run: echo "IMAGE_NAME_LOWER=$(echo ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
30+
31+
- name: Deploy to Azure Web App
32+
id: deploy-to-webapp
33+
uses: azure/webapps-deploy@v2
34+
with:
35+
app-name: ${{ env.AZURE_WEBAPP_NAME }}
36+
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
37+
images: '${{ env.IMAGE_NAME_LOWER }}:latest'
38+
slot-name: 'production'

.gitignore

105 Bytes
Binary file not shown.

AZURE_DEPLOYMENT_SETUP.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Azure Deployment Setup Guide
2+
3+
## Current Status
4+
**Docker Build Fixed**: The platform-specific dependency issue has been resolved
5+
⚠️ **Deployment Issue**: Azure authentication needs to be configured
6+
7+
## Deployment Options
8+
9+
### Option 1: Service Principal Authentication (Recommended)
10+
11+
1. **Create Azure Service Principal**:
12+
```bash
13+
az ad sp create-for-rbac --name "GitHub-Actions-SP" --role contributor \
14+
--scopes /subscriptions/{subscription-id}/resourceGroups/{resource-group} \
15+
--sdk-auth
16+
```
17+
18+
2. **Add GitHub Secret**:
19+
- Go to GitHub repo → Settings → Secrets and variables → Actions
20+
- Add new secret: `AZURE_CREDENTIALS`
21+
- Value: The entire JSON output from step 1
22+
23+
3. **Update Environment Variables**:
24+
- In `.github/workflows/deploy-azure.yml`
25+
- Change `AZURE_WEBAPP_NAME: 'your-app-name'` to your actual Azure App Service name
26+
27+
### Option 2: Publish Profile Authentication
28+
29+
1. **Get Publish Profile**:
30+
- In Azure Portal → App Service → Get publish profile
31+
- Download the `.publishsettings` file
32+
33+
2. **Add GitHub Secret**:
34+
- Add new secret: `AZURE_WEBAPP_PUBLISH_PROFILE`
35+
- Value: Contents of the `.publishsettings` file
36+
37+
3. **Use Alternative Workflow**:
38+
- Rename `deploy-azure-publishprofile.yml` to `deploy-azure.yml`
39+
- Or update the current workflow to use publish-profile instead of service principal
40+
41+
## Required GitHub Secrets
42+
43+
### For Service Principal (Current workflow):
44+
- `AZURE_CREDENTIALS`: JSON from service principal creation
45+
46+
### For Publish Profile (Alternative):
47+
- `AZURE_WEBAPP_PUBLISH_PROFILE`: Contents of .publishsettings file
48+
49+
## Azure App Service Setup
50+
51+
1. **Create App Service**:
52+
```bash
53+
# Create resource group
54+
az group create --name myResourceGroup --location "East US"
55+
56+
# Create App Service plan
57+
az appservice plan create --name myAppServicePlan --resource-group myResourceGroup --is-linux --sku B1
58+
59+
# Create Web App
60+
az webapp create --name your-app-name --resource-group myResourceGroup --plan myAppServicePlan --deployment-container-image-name nginx
61+
```
62+
63+
2. **Configure Container Settings**:
64+
- Enable container logging
65+
- Set startup command if needed
66+
- Configure environment variables
67+
68+
## Testing the Deployment
69+
70+
1. **Manual Trigger**:
71+
- Go to GitHub Actions → Deploy to Azure App Service → Run workflow
72+
73+
2. **Automatic Trigger**:
74+
- Push changes to main branch
75+
- Docker build completes successfully
76+
- Deployment triggers automatically
77+
78+
## Troubleshooting
79+
80+
- **Authentication Errors**: Check if secrets are properly set
81+
- **Image Pull Errors**: Ensure GitHub Container Registry access is configured
82+
- **App Service Errors**: Check Azure App Service logs
83+
84+
## Next Steps
85+
86+
1. Choose authentication method (Service Principal recommended)
87+
2. Set up required GitHub secrets
88+
3. Update `AZURE_WEBAPP_NAME` in workflow
89+
4. Test deployment
90+
91+
## Available Docker Images
92+
93+
After the successful build, these images are available:
94+
- `ghcr.io/trackman/tps-app-scripting/app-scripting-editor:latest`
95+
- `ghcr.io/trackman/tps-app-scripting/app-scripting-editor:main`
96+
- `ghcr.io/trackman/tps-app-scripting/app-scripting-editor:main-<commit-sha>`

0 commit comments

Comments
 (0)