Publish App Common bundle #436
Workflow file for this run
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
# Copyright 2020 Energinet DataHub A/S | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License2"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
name: Publish App Common bundle | |
on: | |
# Build, test, pack and publish release packages | |
# Only executed if (*.)Commonm, (*.)FunctionApp or (*.)WebApp packages content or build scripts has changed; not if solution file, documentation or tests has changed | |
push: | |
branches: | |
- main | |
paths: | |
- source/App/source/Common/** | |
- source/App/source/Common.Abstractions/** | |
- source/App/source/FunctionApp/** | |
- source/App/source/WebApp/** | |
- .github/workflows/app-common-bundle-publish.yml | |
# Build, test, pack | |
# Executed if App folder or build scripts has changed; including if documentation or tests has changed | |
workflow_call: {} | |
# Build, test, pack and publish prerelease packages | |
# Executed if manually triggered | |
workflow_dispatch: {} | |
env: | |
# Conditions | |
PUSH_PACKAGES: ${{ github.event_name != 'pull_request' }} | |
# Necessary to manage Azure resources from automated tests | |
AZURE_KEYVAULT_URL: ${{ vars.integration_test_azure_keyvault_url }} | |
# Set value used by 'AzuriteManager' | |
# Use 'AzuriteBlobFolderPath' for TestCommon version 4.2.0 and lower | |
AzuriteBlobFolderPath: ${{ github.workspace }}\node_modules\.bin\ | |
# Use 'AzuriteFolderPath' for TestCommon version 4.3.0 and higher | |
AzuriteFolderPath: ${{ github.workspace }}\node_modules\.bin\ | |
# Overrides settings in 'functionhost.settings.json' | |
FunctionAppHostPath: ${{ github.workspace }}\node_modules\azure-functions-core-tools\bin\func.dll | |
jobs: | |
build_and_publish: | |
runs-on: windows-2022 | |
name: Publish bundle to NuGet.org | |
environment: AzureAuth | |
# We need to have permissions here to be able to support manually triggering this workflow for releasing a pre-release | |
permissions: | |
id-token: write # Needed by 'dotnet-solution-build-and-test' to login to Azure | |
contents: read # Needed by https://github.com/EnricoMi/publish-unit-test-result-action | |
issues: read # Needed by https://github.com/EnricoMi/publish-unit-test-result-action | |
checks: write # Needed by https://github.com/EnricoMi/publish-unit-test-result-action | |
pull-requests: write # Needed by https://github.com/EnricoMi/publish-unit-test-result-action | |
steps: | |
- name: Checkout repository | |
uses: Energinet-DataHub/.github/.github/actions/nuget-checkout-repository@v13 | |
- name: Setup dotnet and tools | |
uses: Energinet-DataHub/.github/.github/actions/dotnet-setup-and-tools@v13 | |
with: | |
use_azure_functions_tools: "true" | |
azure_functions_core_tools_version: 4.0.5455 | |
- name: Build and test solution | |
uses: Energinet-DataHub/.github/.github/actions/dotnet-solution-build-and-test@v13 | |
with: | |
solution_file_path: ./source/App/App.sln | |
azure_tenant_id: ${{ vars.integration_test_azure_tenant_id }} | |
azure_subscription_id: ${{ vars.integration_test_azure_subscription_id }} | |
azure_spn_id: ${{ vars.integration_test_azure_spn_id_oidc }} | |
publish_test_report: "true" | |
- name: Pack Common project | |
uses: Energinet-DataHub/.github/.github/actions/nuget-project-pack@v13 | |
with: | |
project_path: ./source/App/source/Common/Common.csproj | |
- name: Pack Common.Abstractions project | |
uses: Energinet-DataHub/.github/.github/actions/nuget-project-pack@v13 | |
with: | |
project_path: ./source/App/source/Common.Abstractions/Common.Abstractions.csproj | |
- name: Pack FunctionApp project | |
uses: Energinet-DataHub/.github/.github/actions/nuget-project-pack@v13 | |
with: | |
project_path: ./source/App/source/FunctionApp/FunctionApp.csproj | |
- name: Pack WebApp project | |
uses: Energinet-DataHub/.github/.github/actions/nuget-project-pack@v13 | |
with: | |
project_path: ./source/App/source/WebApp/WebApp.csproj | |
- name: Package content or build has changed | |
id: changed-content | |
uses: tj-actions/changed-files@v41 | |
with: | |
files: | | |
source/App/source/Common/**/*.* | |
source/App/source/Common.Abstractions/**/*.* | |
source/App/source/FunctionApp/**/*.* | |
source/App/source/WebApp/**/*.* | |
.github/workflows/app-common-bundle-publish.yml | |
- name: Assert versions of NuGet packages and push them to NuGet.org | |
uses: Energinet-DataHub/.github/.github/actions/nuget-packages-assert-and-push@v13 | |
with: | |
push_packages: ${{ env.PUSH_PACKAGES }} | |
content_changed: ${{ steps.changed-content.outputs.any_changed }} | |
nuget_token: ${{ secrets.nuget_token }} | |
nupkg_recurse_path: source/App/source | |
# | |
# Branch policy status check | |
# | |
allow_merge: | |
runs-on: ubuntu-latest | |
needs: [build_and_publish] | |
if: | | |
always() | |
steps: | |
- name: Verify if merge is allowed | |
run: | | |
echo "${{ toJSON(needs) }}" | |
if [[ ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }} = true ]]; then | |
echo "Failed" | |
exit 1 | |
fi |