FOUNDATIONS: IServiceProvider part in InjectionDependencyService #109
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
name: Build | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
- closed | |
branches: | |
- main | |
env: | |
IS_RELEASE_CANDIDATE: >- | |
${{ | |
( | |
github.event_name == 'pull_request' && | |
startsWith(github.event.pull_request.title, 'RELEASES:') && | |
contains(github.event.pull_request.labels.*.name, 'RELEASES') | |
) | |
|| | |
( | |
github.event_name == 'push' && | |
startsWith(github.event.head_commit.message, 'RELEASES:') && | |
startsWith(github.ref_name, 'RELEASE') | |
) | |
}} | |
jobs: | |
label: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Apply Label | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ secrets.PAT_FOR_TAGGING }} | |
script: >2 | |
if (!context.payload.pull_request) { | |
console.log('Not a pull request, skipping label script routine'); | |
return; | |
} | |
const prefixes = [ | |
'INFRA:', | |
'PROVISIONS:', | |
'RELEASES:', | |
'DATA:', | |
'BROKERS:', | |
'FOUNDATIONS:', | |
'PROCESSINGS:', | |
'ORCHESTRATIONS:', | |
'COORDINATIONS:', | |
'MANAGEMENTS:', | |
'AGGREGATIONS:', | |
'CONTROLLERS:', | |
'CLIENTS:', | |
'EXPOSERS:', | |
'PROVIDERS:', | |
'BASE:', | |
'COMPONENTS:', | |
'VIEWS:', | |
'PAGES:', | |
'ACCEPTANCE:', | |
'INTEGRATIONS:', | |
'CODE RUB:', | |
'MINOR FIX:', | |
'MEDIUM FIX:', | |
'MAJOR FIX:', | |
'DOCUMENTATION:', | |
'CONFIG:', | |
'STANDARD:', | |
'DESIGN:', | |
'BUSINESS:' | |
]; | |
const title = context.payload.pull_request.title; | |
const existingLabels = context.payload.pull_request.labels.map(label => label.name); | |
for (const prefix of prefixes) { | |
if (title.startsWith(prefix)) { | |
const label = prefix.slice(0, -1); | |
if (!existingLabels.includes(label)) { | |
console.log(`Applying label: ${label}`); | |
await github.rest.issues.addLabels({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.payload.pull_request.number, | |
labels: [label] | |
}); | |
} | |
break; | |
} | |
} | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out | |
uses: actions/checkout@v3 | |
- name: Setup .Net | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 7.0.201 | |
- name: Restore | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --no-restore | |
- name: Test | |
run: dotnet test --no-build --verbosity normal | |
add_tag: | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
if: >- | |
needs.build.result == 'success' && | |
github.event.pull_request.merged && | |
github.event.pull_request.base.ref == 'main' && | |
startsWith(github.event.pull_request.title, 'RELEASES:') && | |
contains(github.event.pull_request.labels.*.name, 'RELEASES') | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.PAT_FOR_TAGGING }} | |
- name: Configure Git | |
run: >- | |
git config user.name "GitHub Action" | |
git config user.email "[email protected]" | |
- name: Extract Version | |
id: extract_version | |
run: > | |
# Running on Linux/Unix | |
sudo apt-get install xmlstarlet | |
version_number=$(xmlstarlet sel -t -v "//Version" -n STX.SPAL.Core/STX.SPAL.Core.csproj) | |
echo "$version_number" | |
echo "version_number<<EOF" >> $GITHUB_OUTPUT | |
echo "$version_number" >> $GITHUB_OUTPUT | |
echo "EOF" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Display Version | |
run: 'echo "Version number: ${{ steps.extract_version.outputs.version_number }}"' | |
- name: Extract Package Release Notes | |
id: extract_package_release_notes | |
run: > | |
# Running on Linux/Unix | |
sudo apt-get install xmlstarlet | |
package_release_notes=$(xmlstarlet sel -t -v "//PackageReleaseNotes" -n STX.SPAL.Core/STX.SPAL.Core.csproj) | |
echo "$package_release_notes" | |
echo "package_release_notes<<EOF" >> $GITHUB_OUTPUT | |
echo "$package_release_notes" >> $GITHUB_OUTPUT | |
echo "EOF" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Display Package Release Notes | |
run: 'echo "Package Release Notes: ${{ steps.extract_package_release_notes.outputs.package_release_notes }}"' | |
- name: Create GitHub Tag | |
run: >- | |
git tag -a "v${{ steps.extract_version.outputs.version_number }}" -m "Release - v${{ steps.extract_version.outputs.version_number }}" | |
git push origin --tags | |
- name: Create GitHub Release | |
uses: actions/create-release@v1 | |
with: | |
tag_name: v${{ steps.extract_version.outputs.version_number }} | |
release_name: Release - v${{ steps.extract_version.outputs.version_number }} | |
body: >- | |
## Release - v${{ steps.extract_version.outputs.version_number }} | |
### Release Notes | |
${{ steps.extract_package_release_notes.outputs.package_release_notes }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT_FOR_TAGGING }} | |
publish: | |
runs-on: ubuntu-latest | |
needs: | |
- add_tag | |
if: needs.add_tag.result == 'success' | |
steps: | |
- name: Check out | |
uses: actions/checkout@v3 | |
- name: Setup .Net | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 7.0.201 | |
- name: Restore | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --no-restore --configuration Release | |
- name: Pack NuGet Package | |
run: dotnet pack --configuration Release --include-symbols | |
- name: Push NuGet Package | |
run: dotnet nuget push **/bin/Release/**/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_ACCESS }} --skip-duplicate |