Merge pull request #10 from tarilen/feat/rum-web-analytics #26
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 | |
| on: | |
| push: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| permissions: | |
| id-token: write | |
| contents: read | |
| env: | |
| # Standard Azure envs for azure/login | |
| ARM_USE_OIDC: "true" | |
| ARM_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} | |
| ARM_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} | |
| ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
| # TF_VAR_ prefixes map to OpenTofu/Terraform variables | |
| TF_VAR_client_id: ${{ secrets.AZURE_CLIENT_ID }} | |
| TF_VAR_tenant_id: ${{ secrets.AZURE_TENANT_ID }} | |
| TF_VAR_subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
| jobs: | |
| provision-and-upload: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Azure OIDC login | |
| uses: azure/login@v2 | |
| with: | |
| client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
| tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
| subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
| - name: Install OpenTofu | |
| uses: opentofu/setup-opentofu@v1 | |
| with: | |
| tofu_version: "1.6.0" | |
| - name: Init/Apply OpenTofu | |
| working-directory: tofu | |
| run: | | |
| tofu init -upgrade | |
| tofu apply -auto-approve -input=false | |
| - name: Read outputs | |
| id: tfout | |
| working-directory: tofu | |
| run: | | |
| echo "web=$(tofu output -raw static_web_url)" >> "$GITHUB_OUTPUT" | |
| TOKEN=$(tofu output -raw swa_api_token) | |
| echo "::add-mask::$TOKEN" | |
| echo "token=$TOKEN" >> "$GITHUB_OUTPUT" | |
| - name: Deploy site to Static Web App | |
| uses: Azure/static-web-apps-deploy@v1 | |
| with: | |
| azure_static_web_apps_api_token: ${{ steps.tfout.outputs.token }} | |
| action: upload | |
| app_location: "site" | |
| skip_app_build: true | |
| - name: Post the site URL | |
| run: | | |
| echo "Site: ${{ steps.tfout.outputs.web }}" |