Merge pull request #53 from codemonkey85/dev #144
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: Deploy to GitHub Pages | |
| permissions: | |
| id-token: write | |
| contents: read | |
| # Run workflow on every push to the main branch | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [ main ] | |
| paths-ignore: | |
| - "**.md" | |
| - ".editorconfig" | |
| - '**/*.gitignore' | |
| - '**/*.gitattributes' | |
| - '**/*.yml' | |
| jobs: | |
| build: | |
| name: Build and Deploy | |
| # use ubuntu-latest image to run steps on | |
| runs-on: ubuntu-latest | |
| env: | |
| AZURE_ENV_NAME: aboutme | |
| steps: | |
| # uses GitHub's checkout action to checkout code form the main branch | |
| - name: Checkout code | |
| uses: actions/checkout@v4.2.2 | |
| # sets up .NET SDK | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4.3.1 | |
| with: | |
| global-json-file: ./global.json | |
| - name: Install WASM workload | |
| run: dotnet workload install wasm-tools | |
| - name: Restore dependencies | |
| run: dotnet restore src/aboutme.sln | |
| - name: Build | |
| run: dotnet build src/aboutme.sln --configuration Release --no-restore | |
| - name: Install Azure Developer CLI | |
| run: | | |
| curl -fsSL https://aka.ms/install-azd.sh | bash | |
| - name: Authenticate with Azure | |
| uses: azure/login@v2.3.0 | |
| with: | |
| client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
| tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
| subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
| - name: azd login with service principal | |
| run: azd auth login --client-id ${{ fromJson(secrets.AZURE_CREDENTIALS).clientId }} --client-secret ${{ fromJson(secrets.AZURE_CREDENTIALS).clientSecret }} --tenant-id ${{ fromJson(secrets.AZURE_CREDENTIALS).tenantId }} | |
| - name: Provision resources | |
| run: azd provision --no-prompt | |
| env: | |
| AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} | |
| AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} | |
| AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
| AZURE_ENV_NAME: aboutme | |
| AZD_AUTH_TYPE: federated | |
| - name: Deploy application | |
| run: azd deploy --no-prompt | |
| env: | |
| AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} | |
| AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} | |
| AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
| AZURE_ENV_NAME: aboutme | |
| AZD_AUTH_TYPE: federated | |
| - name: Logout from Azure | |
| run: az logout |