diff --git a/.github/workflows/provision-deploy.yml b/.github/workflows/provision-deploy.yml index 1af0cef..76d814e 100644 --- a/.github/workflows/provision-deploy.yml +++ b/.github/workflows/provision-deploy.yml @@ -25,7 +25,7 @@ env: FUNC_PROJECT: TimeTrackerBot/TimeTrackerBot.csproj jobs: - deploy-infrastructure: + provision-infrastructure: name: 'Terraform Apply' runs-on: ubuntu-latest env: @@ -117,13 +117,10 @@ jobs: id: terraformOutputsStep run: | echo "FUNCTIONS_APP_NAME=$(terraform -chdir=infra output -raw function_app_name)" >> "$GITHUB_OUTPUT" - - build-and-deploy: - name: Build and deploy + + build: + name: Build runs-on: ubuntu-latest - needs: deploy-infrastructure - env: - FUNCTIONS_APP_NAME: ${{ needs.deploy-infrastructure.outputs.functionAppName }} steps: - uses: actions/checkout@v4 @@ -141,15 +138,31 @@ jobs: - name: Publish run: dotnet publish "${{ env.WORKING_DIRECTORY }}/${{ env.FUNC_PROJECT }}" --configuration ${{ env.CONFIGURATION }} --output "${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}" - - - name: Install Azure CLI - run: | - curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash - - name: Login to Azure - uses: azure/login@v2 + - name: Upload + uses: actions/upload-artifact@v4 + with: + name: published + path: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }} + + deploy: + name: Deploy + runs-on: ubuntu-latest + needs: [provision-infrastructure, build] + env: + FUNCTIONS_APP_NAME: ${{ needs.provision-infrastructure.outputs.functionAppName }} + + steps: + - name: Download + uses: actions/download-artifact@v4 + with: + name: published + path: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }} + + - name: 'Login via Azure CLI' + uses: azure/login@v1 with: - creds: '{"clientId":"${{ secrets.AZURE_CLIENT_ID }}","clientSecret":"${{ secrets.AZURE_CLIENT_SECRET }}","subscriptionId":"${{ secrets.AZURE_SUBSCRIPTION_ID }}","tenantId":"${{ secrets.AZURE_TENANT_ID }}"}' + creds: ${{ secrets.AZURE_RBAC_CREDENTIALS }} - name: Deploy to Azure Function App uses: Azure/functions-action@v1