Skip to content

update publications to use local api #96

update publications to use local api

update publications to use local api #96

# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions
name: Build and deploy ASP.Net Core app to Azure Web App - app-umbraco-multisite
on:
push:
branches:
- release
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.x'
include-prerelease: true
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Set Web App Settings
uses: Azure/appservice-settings@v1
with:
app-name: 'app-umbraco-multisite'
slot-name: 'staging'
app-settings-json: |
[
{
"name": "Umbraco:CMS:Global:Smtp:Host",
"value": "${{ secrets.SMTP_HOST }}",
"slotSetting": true
},
{
"name": "Umbraco:CMS:Global:Smtp:Username",
"value": "${{ secrets.SMTP_USERNAME }}",
"slotSetting": true
},
{
"name": "Umbraco:CMS:Global:Smtp:Password",
"value": "${{ secrets.SMTP_PASSWORD }}",
"slotSetting": true
},
{
"name": "Umbraco:CMS:DeliveryApi:ApiKey",
"value": "${{ secrets.APIKEY }}",
"slotSetting": true
},
{
"name": "uSync:Publisher:Settings:AppId",
"value": "${{ secrets.USYNC_APPID }}",
"slotSetting": true
},
{
"name": "uSync:Publisher:Settings:AppKey",
"value": "${{ secrets.USYNC_APPKEY }}",
"slotSetting": true
},
{
"name": "AzureSSO:Credentials:Domain",
"value": "${{ secrets.AZURESSO_DOMAIN }}",
"slotSetting": true
},
{
"name": "AzureSSO:Credentials:TenantId",
"value": "${{ secrets.AZURESSO_TENANTID }}",
"slotSetting": true
},
{
"name": "AzureSSO:Credentials:ClientId",
"value": "${{ secrets.AZURESSO_CLIENTID }}",
"slotSetting": true
},
{
"name": "AzureSSO:Credentials:ClientSecret",
"value": "${{ secrets.AZURESSO_CLIENTSECRET }}",
"slotSetting": true
}
]
- name: Azure CLI script
uses: azure/CLI@v1
with:
inlineScript: |
az logout
az cache purge
az account clear
- name: Clean with dotnet
run: dotnet clean
- name: dotnet publish
run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/myapp
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v4
with:
name: .net-app
path: ${{env.DOTNET_ROOT}}/myapp
deploy:
runs-on: windows-latest
needs: build
environment:
name: 'staging'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: .net-app
- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'app-umbraco-multisite'
slot-name: 'staging'
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_B1366671861145DF83D35E7611409422 }}
package: .
- name: Database Initialization
run: |
# Database initialization commands go here
# Example: Load data from an SQL dump file
# sqlcmd -S $SERVER -U $USERNAME -P $PASSWORD -d $DATABASE -i path/to/dump.sql
# For SQLite, you can set the connection string directly in your Umbraco application
echo "ConnectionStrings__umbracoDbDSN=Data Source=${{ env.DOTNET_ROOT }}/myapp/Wmca.Web/umbraco/Data/Umbraco.sqlite.db;Cache=Shared;Foreign Keys=True;Pooling=True" >> $GITHUB_ENV
env:
SERVER: ${{ secrets.DB_SERVER }}
USERNAME: ${{ secrets.DB_USERNAME }}
PASSWORD: ${{ secrets.DB_PASSWORD }}
DATABASE: ${{ secrets.DB_DATABASE }}