From 53cce474f02606ebd83ff9f5a4b7dd617d073c3d Mon Sep 17 00:00:00 2001 From: Akshay Kumar Date: Fri, 20 Feb 2026 12:10:50 +0530 Subject: [PATCH 1/2] Add a file to keep the version --- src/main.ts | 3 ++- src/version.ts | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 src/version.ts diff --git a/src/main.ts b/src/main.ts index 752c79395..05400460c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -8,6 +8,7 @@ import { DEPLOYMENT_PROVIDER_TYPES } from "./DeploymentProvider/Providers/BaseWe import { DeploymentProviderFactory } from './DeploymentProvider/DeploymentProviderFactory'; import { IAuthorizer } from 'azure-actions-webclient/Authorizer/IAuthorizer'; import { ValidatorFactory } from './ActionInputValidator/ValidatorFactory'; +import { VERSION } from './version'; var prefix = !!process.env.AZURE_HTTP_USER_AGENT ? `${process.env.AZURE_HTTP_USER_AGENT}` : ""; @@ -18,7 +19,7 @@ export async function main() { // Set user agent variable let usrAgentRepo = crypto.createHash('sha256').update(`${process.env.GITHUB_REPOSITORY}`).digest('hex'); let actionName = 'DeployWebAppToAzure'; - let userAgentString = (!!prefix ? `${prefix}+` : '') + `GITHUBACTIONS_${actionName}_${usrAgentRepo}`; + let userAgentString = (!!prefix ? `${prefix}+` : '') + `GITHUBACTIONS_${actionName}_${usrAgentRepo}_${VERSION}`; core.exportVariable('AZURE_HTTP_USER_AGENT', userAgentString); // Initialize action inputs diff --git a/src/version.ts b/src/version.ts new file mode 100644 index 000000000..4a7906d32 --- /dev/null +++ b/src/version.ts @@ -0,0 +1,2 @@ +// Update this file before release. +export const VERSION = 'dev'; From 001401d3ccf4f63286b3a65fa23c70311cb17034 Mon Sep 17 00:00:00 2001 From: Akshay Kumar Date: Mon, 23 Feb 2026 13:19:18 +0530 Subject: [PATCH 2/2] Add github actions tests --- .../github_actions_test_releases_v2.yml | 99 ++++++++++++++++ .../github_actions_test_releases_v3.yml | 106 ++++++++++++++++++ .github/workflows/github_actions_test_v2.yml | 6 +- .github/workflows/github_actions_test_v3.yml | 28 ++--- 4 files changed, 216 insertions(+), 23 deletions(-) create mode 100644 .github/workflows/github_actions_test_releases_v2.yml create mode 100644 .github/workflows/github_actions_test_releases_v3.yml diff --git a/.github/workflows/github_actions_test_releases_v2.yml b/.github/workflows/github_actions_test_releases_v2.yml new file mode 100644 index 000000000..2dd481359 --- /dev/null +++ b/.github/workflows/github_actions_test_releases_v2.yml @@ -0,0 +1,99 @@ +# 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 to Azure App Services using releases/v2 + +on: + push: + branches: + - master + schedule: + - cron: "0 0/3 * * *" + +jobs: + build-and-deploy-dotnet-app: + runs-on: ubuntu-latest + + permissions: + id-token: write + + steps: + - uses: actions/checkout@v4 + + - name: Modify the sample app + run: | + cp -r ./__tests__/dotnetsampleapp dotnetapp + current_utc_time=$(date -u +"%Y-%m-%d %H:%M:%S %Z") + sed -i "s/<<>>/$current_utc_time/g" dotnetapp/Controllers/HelloController.cs + + echo "The placeholder has been replaced with current UTC time: $current_utc_time" + + - name: Set up .NET Core + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.x' + + - name: Build with dotnet + run: dotnet build --configuration Release dotnetapp/DOTNET_8_APP.csproj + + - name: dotnet publish + run: dotnet publish dotnetapp/DOTNET_8_APP.csproj -c Release -o myapp + + - name: Upload artifact for deployment job + uses: actions/upload-artifact@v4 + with: + name: .net-app + path: myapp + + - name: Deploy to Azure Web App + id: deploy-to-webapp + uses: azure/webapps-deploy@releases/v2 + with: + app-name: 'lwasv2-euap-dotnet-githubactionstest' + slot-name: 'Production' + package: myapp + publish-profile: ${{ secrets.LWASV2_EUAP_DOTNET_GITHUBACTIONSTEST }} + + build-and-deploy-node-app: + runs-on: ubuntu-latest + + permissions: + id-token: write + + steps: + - uses: actions/checkout@v4 + + - name: modify Node.js App + run: | + cp -r ./__tests__/nodesampleapp nodeapp + current_utc_time=$(date -u +"%Y-%m-%d %H:%M:%S %Z") + sed -i "s/<<>>/$current_utc_time/g" nodeapp/server.js + + echo "The placeholder has been replaced with current UTC time: $current_utc_time" + + - name: Set up Node.js version + uses: actions/setup-node@v3 + with: + node-version: '20.x' + + - name: npm ci, build, and test + run: | + cd nodeapp + npm ci + npm run build --if-present + npm run test --if-present + + - name: Upload artifact for deployment job + uses: actions/upload-artifact@v4 + with: + name: node-app + path: nodeapp + + - name: 'Deploy to Azure Web App' + id: deploy-to-webapp + uses: azure/webapps-deploy@releases/v2 + with: + app-name: 'lwasv2-euap-node-githubactions' + slot-name: 'Production' + package: nodeapp + publish-profile: ${{ secrets.LWASV2_EUAP_NODE_GITHUBACTIONS }} \ No newline at end of file diff --git a/.github/workflows/github_actions_test_releases_v3.yml b/.github/workflows/github_actions_test_releases_v3.yml new file mode 100644 index 000000000..24f4257af --- /dev/null +++ b/.github/workflows/github_actions_test_releases_v3.yml @@ -0,0 +1,106 @@ +# 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 to Azure App Services using releases/v3 + +on: + push: + branches: + - master + schedule: + - cron: "0 0/3 * * *" + +jobs: + build-and-deploy-dotnet-app: + runs-on: ubuntu-latest + + permissions: + id-token: write + + steps: + - uses: actions/checkout@v4 + + - name: Modify the sample app + run: | + cp -r ./__tests__/dotnetsampleapp dotnetapp + current_utc_time=$(date -u +"%Y-%m-%d %H:%M:%S %Z") + sed -i "s/<<>>/$current_utc_time/g" dotnetapp/Controllers/HelloController.cs + + echo "The placeholder has been replaced with current UTC time: $current_utc_time" + + - name: Set up .NET Core + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.x' + + - name: Build with dotnet + run: dotnet build --configuration Release dotnetapp/DOTNET_8_APP.csproj + + - name: dotnet publish + run: dotnet publish dotnetapp/DOTNET_8_APP.csproj -c Release -o myapp + + - name: Upload artifact for deployment job + uses: actions/upload-artifact@v4 + with: + name: .net-app + path: myapp + + - name: Deploy to Azure Web App + id: deploy-to-webapp + uses: azure/webapps-deploy@releases/v3 + with: + app-name: 'lwasv2-euap-dotnet-githubactionstest-release-v3' + slot-name: 'Production' + package: myapp + publish-profile: ${{ secrets.LWASV2_EUAP_DOTNET_GITHUBACTIONSTEST_RELEASE_V3 }} + + build-and-deploy-node-app: + runs-on: ubuntu-latest + + permissions: + id-token: write + + steps: + - uses: actions/checkout@v4 + + - name: modify Node.js App + run: | + cp -r ./__tests__/nodesampleapp nodeapp + current_utc_time=$(date -u +"%Y-%m-%d %H:%M:%S %Z") + sed -i "s/<<>>/$current_utc_time/g" nodeapp/server.js + + echo "The placeholder has been replaced with current UTC time: $current_utc_time" + + - name: Set up Node.js version + uses: actions/setup-node@v3 + with: + node-version: '18.x' + + - name: npm ci, build, and test + run: | + cd nodeapp + npm ci + npm run build --if-present + npm run test --if-present + + - name: Upload artifact for deployment job + uses: actions/upload-artifact@v4 + with: + name: node-app + path: nodeapp + + - name: Login to Azure + uses: azure/login@v2 + with: + client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_NODEAPP1 }} + tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID }} + subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID }} + + - name: 'Deploy to Azure Web App' + id: deploy-to-webapp + uses: azure/webapps-deploy@releases/v3 + with: + app-name: 'lwasv2-euap-node-githubactions-release-v3' + slot-name: 'Production' + package: nodeapp + publish-profile: ${{ secrets.LWASV2_EUAP_NODE_GITHUBACTIONS_RELEASE_V3 }} \ No newline at end of file diff --git a/.github/workflows/github_actions_test_v2.yml b/.github/workflows/github_actions_test_v2.yml index b7ac1535d..e0b858344 100644 --- a/.github/workflows/github_actions_test_v2.yml +++ b/.github/workflows/github_actions_test_v2.yml @@ -1,7 +1,7 @@ # 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 to Azure App Services +name: Build and deploy to Azure App Services using v2 on: push: @@ -47,7 +47,7 @@ jobs: - name: Deploy to Azure Web App id: deploy-to-webapp - uses: azure/webapps-deploy@releases/v2 + uses: azure/webapps-deploy@v2 with: app-name: 'lwasv2-euap-dotnet-githubactionstest-v2' slot-name: 'Production' @@ -91,7 +91,7 @@ jobs: - name: 'Deploy to Azure Web App' id: deploy-to-webapp - uses: azure/webapps-deploy@releases/v2 + uses: azure/webapps-deploy@v2 with: app-name: 'lwasv2-euap-node-githubactions-v2' slot-name: 'Production' diff --git a/.github/workflows/github_actions_test_v3.yml b/.github/workflows/github_actions_test_v3.yml index e914019d5..62c5f7731 100644 --- a/.github/workflows/github_actions_test_v3.yml +++ b/.github/workflows/github_actions_test_v3.yml @@ -1,7 +1,7 @@ # 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 to Azure App Services +name: Build and deploy to Azure App Services using v3 on: push: @@ -45,20 +45,14 @@ jobs: name: .net-app path: myapp - - name: Login to Azure - uses: azure/login@v2 - with: - client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_DOTNETAPP1 }} - tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID }} - subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID }} - - name: Deploy to Azure Web App id: deploy-to-webapp - uses: azure/webapps-deploy@releases/v3 + uses: azure/webapps-deploy@v3 with: - app-name: 'lwasv2-euap-dotnet-githubactionstest' + app-name: 'lwasv2-euap-dotnet-githubactionstest-v3' slot-name: 'Production' package: myapp + publish-profile: ${{ secrets.LWASV2_EUAP_DOTNET_GITHUBACTIONSTEST_V3 }} build-and-deploy-node-app: runs-on: ubuntu-latest @@ -94,18 +88,12 @@ jobs: with: name: node-app path: nodeapp - - - name: Login to Azure - uses: azure/login@v2 - with: - client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_NODEAPP1 }} - tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID }} - subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID }} - name: 'Deploy to Azure Web App' id: deploy-to-webapp - uses: azure/webapps-deploy@releases/v3 + uses: azure/webapps-deploy@v3 with: - app-name: 'lwasv2-euap-node-githubactions' + app-name: 'lwasv2-euap-node-githubactions-v3' slot-name: 'Production' - package: nodeapp \ No newline at end of file + package: nodeapp + publish-profile: ${{ secrets.LWASV2_EUAP_NODE_GITHUBACTIONS_RELEASE_V3 }}