-
Notifications
You must be signed in to change notification settings - Fork 2
113 lines (97 loc) · 4.13 KB
/
outbox-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
# 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 Outbox bundle
on:
# Build, test, pack and publish release packages
# Only executed if (*.)Outbox packages content or build scripts has changed; not if solution file, documentation or tests has changed
push:
branches:
- main
paths:
- source/Outbox/source/Outbox/**
- source/Outbox/source/Outbox.Abstractions/**
- .github/workflows/outbox-bundle-publish.yml
# Build, test, pack
# Executed if Outbox 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' }}
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"
azurite_version: 3.31.0
- name: Build and test solution
uses: Energinet-DataHub/.github/.github/actions/dotnet-solution-build-and-test@v13
with:
solution_file_path: ./source/Outbox/Outbox.sln
publish_test_report: "true"
- name: Pack Outbox project
uses: Energinet-DataHub/.github/.github/actions/nuget-project-pack@v13
with:
project_path: ./source/Outbox/source/Outbox/Outbox.csproj
- name: Pack Outbox.Abstractions project
uses: Energinet-DataHub/.github/.github/actions/nuget-project-pack@v13
with:
project_path: ./source/Outbox/source/Outbox.Abstractions/Outbox.Abstractions.csproj
- name: Package content or build has changed
id: changed-content
uses: tj-actions/changed-files@v41
with:
files: |
source/Outbox/source/Outbox/**/*.*
source/Outbox/source/Outbox.Abstractions/**/*.*
.github/workflows/outbox-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/Outbox/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