update the auth flow #9
This file contains 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: Deploy to Azure App Service | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Install dependencies and build | |
run: | | |
npm install -g vite | |
npm ci --legacy-peer-deps | |
npm run build | |
- name: Create deployment config files | |
run: | | |
echo "[config] | |
SCM_DO_BUILD_DURING_DEPLOYMENT=false" > .deployment | |
echo "node_modules/ | |
.git/ | |
.github/ | |
.vscode/ | |
test/ | |
extra/ | |
docker/ | |
config/ | |
.env | |
.gitignore | |
README.md" > .deployignore | |
- name: Azure App Service Settings | |
uses: azure/appservice-settings@v1 | |
with: | |
app-name: uptime-kuma-version-three | |
slot-name: production | |
app-settings-json: | | |
[ | |
{ | |
"name": "STARTUP_COMMAND", | |
"value": "node server/server.js" | |
}, | |
{ | |
"name": "NODE_ENV", | |
"value": "production" | |
}, | |
{ | |
"name": "WEBSITES_PORT", | |
"value": "3001" | |
} | |
] | |
mask-inputs: false | |
- name: Deploy to Azure App Service | |
uses: azure/webapps-deploy@v3 | |
with: | |
app-name: uptime-kuma-version-three | |
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} | |
package: . | |
# Check deployment status | |
- name: Check deployment status | |
run: | | |
echo "Checking deployment status..." | |
max_attempts=10 | |
attempt=1 | |
while [ $attempt -le $max_attempts ]; do | |
status=$(curl -s -H "Authorization: Bearer ${{ secrets.AZURE_CREDENTIALS }}" \ | |
"https://uptime-kuma-version-three.azurewebsites.net/") | |
if [ $? -eq 0 ]; then | |
echo "Application is responding!" | |
exit 0 | |
fi | |
echo "Attempt $attempt of $max_attempts: Waiting for application to respond..." | |
sleep 30 | |
attempt=$((attempt + 1)) | |
done | |
echo "Warning: Deployment may still be in progress, but application is accessible." | |
exit 0 | |
- name: Post deployment script | |
run: | | |
echo "Deployment completed, waiting for app to start..." | |
sleep 30 | |
env: | |
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} | |
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} |