Clean-up after dropping .NET Core 3.1/.NET 6 #909
This file contains 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: Build | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- .github/workflows/security-scanning.yml | |
- .github/workflows/skipped-build.yml | |
- '.vscode/**' | |
- 'docs/**' | |
- CONTRIBUTING.md | |
- LICENSE | |
- README.md | |
pull_request: | |
branches: | |
- main | |
paths-ignore: | |
- .github/workflows/security-scanning.yml | |
- .github/workflows/skipped-build.yml | |
- '.vscode/**' | |
- 'docs/**' | |
- CONTRIBUTING.md | |
- LICENSE | |
- README.md | |
permissions: | |
id-token: write | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-24.04 | |
concurrency: build | |
permissions: | |
contents: write | |
env: | |
CREATE_RELEASE: ${{ github.ref_name == 'main' && !contains(github.event.head_commit.message, '[skip-release]') && !contains(github.event.head_commit.message, 'dependabot[bot]') }} | |
IS_FEATURE_PULL_REQUEST: ${{ github.event_name == 'pull_request' && startsWith(github.head_ref, 'features/') }} | |
CREATE_PRERELEASE: 'false' | |
PACKAGE_VERSION: | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Azure Functions Core Tools | |
run: | | |
wget -q https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb | |
sudo dpkg -i packages-microsoft-prod.deb | |
sudo apt-get update | |
sudo apt-get install azure-functions-core-tools-4 | |
func version | |
# See https://github.com/Azure/azure-functions-core-tools/issues/3766 | |
sudo chmod +x /usr/lib/azure-functions-core-tools-4/in-proc8/func | |
- name: Build | |
id: build | |
run: | | |
dotnet user-secrets set APPLICATIONINSIGHTS_CONNECTION_STRING '${{ secrets.APPLICATION_INSIGHTS_CONNECTION_STRING }}' --id 074ca336-270b-4832-9a1a-60baf152b727 | |
./build.sh --package | |
env: | |
IntegrationTestServiceBusConnectionString: ${{ secrets.SERVICE_BUS_CONNECTION_STRING }} | |
- name: Upload test results | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: test-results | |
path: './artifacts/test-results/**/*.html' | |
if-no-files-found: error | |
- name: Upload Functions logs | |
uses: actions/upload-artifact@v4 | |
if: ${{ failure() && steps.build.conclusion == 'failure' }} | |
with: | |
name: function-logs | |
path: './artifacts/test-results/*.log' | |
- name: Upload coverage report | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: code-coverage | |
path: artifacts/coverage-report | |
if-no-files-found: error | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: deploy | |
path: | | |
deploy | |
artifacts/out/package | |
artifacts/out/functions/*.zip | |
if-no-files-found: error | |
- name: Determine if we're skipping release on feature Pull Request | |
if: ${{ env.IS_FEATURE_PULL_REQUEST == 'true' }} | |
run: | | |
headCommitMessage=$(git log ${{ github.event.pull_request.head.sha }} -n 1 --format=%B) | |
echo "HEAD commit message is: $headCommitMessage" | |
if [[ $headCommitMessage != *"[skip-release]"* ]]; then | |
echo "CREATE_PRERELEASE=true" >> $GITHUB_ENV | |
fi | |
- name: Create GitHub release on main branch | |
if: ${{ env.CREATE_RELEASE == 'true' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
touch empty-release-notes.txt | |
gh release create ${{ env.PACKAGE_VERSION }} --title ${{ env.PACKAGE_VERSION }} ./artifacts/out/package/* --target ${{ github.sha }} --repo ${{ github.repository }} --notes-file empty-release-notes.txt | |
- name: Create GitHub prerelease on feature Pull Request | |
if: ${{ env.CREATE_PRERELEASE == 'true' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
touch empty-release-notes.txt | |
gh release create ${{ env.PACKAGE_VERSION }} --title ${{ env.PACKAGE_VERSION }} ./artifacts/out/package/* --target ${{ github.sha }} --repo ${{ github.repository }} --notes-file empty-release-notes.txt --prerelease | |
- name: Push NuGet package | |
if: ${{ env.CREATE_RELEASE == 'true' || env.CREATE_PRERELEASE == 'true' }} | |
run: dotnet nuget push ./artifacts/out/package/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} | |
deploy: | |
name: Deploy | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-24.04 | |
environment: PROD | |
needs: build | |
concurrency: deploy | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: deploy | |
- name: Sign-in to Azure | |
uses: azure/login@v2 | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID_1 }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
enable-AzPSSession: true | |
- name: Deploy | |
uses: azure/powershell@v2 | |
with: | |
inlineScript: | | |
deploy/Deploy.ps1 -Location ${{ env.AZURE_LOCATION }} -ResourceNamePrefix ${{ env.RESOURCE_NAME_PREFIX }} | |
azPSVersion: 'latest' | |
env: | |
AZURE_LOCATION: australiaeast | |
RESOURCE_NAME_PREFIX: gabow |