Skip to content

Azure Site Extension #27

Azure Site Extension

Azure Site Extension #27

name: Azure Site Extension
on:
workflow_dispatch:
env:
SPEC_FILE_TEMPLATE: 'zzzNA.Azure.WebSites.Extension.NA.nuspec'
jobs:
setup_tools:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup dotnet '6.0.x'
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
- name: Display dotnet version
run: dotnet --version
- name: Display NuGet version
run: nuget ?
create_extension_bundle:
runs-on: windows-latest
needs:
- setup_tools
strategy:
matrix:
node-version: ['lts/*'] # Node 22 isn't yet available for Windows apps in Azure
arch: [ x86, x64 ]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
architecture: ${{ matrix.arch }}
- name: Find agent version
run: |
$env:npm_agent_version = npm view newrelic version
echo "AGENT_VERSION=$env:npm_agent_version" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Set package filename
run: |
echo "PACKAGE_FILENAME=zzzNA.Azure.WebSites.Extension.NA-${{matrix.arch}}.${{env.AGENT_VERSION}}-${{matrix.arch}}" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Verify environment vars # because we can't access GH env vars until the next step
run: |
echo "Agent version: ${{ env.AGENT_VERSION }}"
echo "Package filename: ${{ env.PACKAGE_FILENAME }}"
- name: Install agent
working-directory: cloud-tooling/azure-site-extension/Content
run: |
npm i --prefix . newrelic@${{ env.AGENT_VERSION }} --verbose
echo "Agent installed"
- name: List directory contents
working-directory: cloud-tooling/azure-site-extension/Content
shell: cmd
run: |
dir
if exist node_modules (
echo node_modules exists
) else (
echo node_modules not found
)
# - name: Upload Content folder
# uses: actions/upload-artifact@v2
# with:
# name: content-folder
# path: cloud-tooling/azure-site-extension/Content
- name: Configure package files
working-directory: cloud-tooling/azure-site-extension
run: |
(Get-Content ${{ env.SPEC_FILE_TEMPLATE }}).Replace('{VERSION}', "${{ env.AGENT_VERSION }}") | Set-Content ${{ env.PACKAGE_FILENAME }}.nuspec
- name: Create bundle
working-directory: cloud-tooling/azure-site-extension
run: nuget pack "${{ env.PACKAGE_FILENAME }}.nuspec"
# - name: Archive package for verification
# uses: actions/upload-artifact@v4
# with:
# name: azure-site-extension-test-${{ env.PACKAGE_FILENAME }}
# path: cloud-tooling/azure-site-extension/${{ env.PACKAGE_FILENAME }}.nupkg
- name: Publish site extension
working-directory: cloud-tooling/azure-site-extension
run: |
dotnet nuget push "${{ env.PACKAGE_FILENAME }}.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --source ${{ secrets.NUGET_SOURCE }}