-
Notifications
You must be signed in to change notification settings - Fork 2
139 lines (121 loc) · 5.52 KB
/
app-common-bundle-publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# 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