Pkg EdFi.Database.Security #583
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
# SPDX-License-Identifier: Apache-2.0 | |
# Licensed to the Ed-Fi Alliance under one or more agreements. | |
# The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0. | |
# See the LICENSE and NOTICES files in the project root for more information. | |
name: Pkg EdFi.Database.Security | |
on: | |
push: | |
branches: [main, 'b-v*-patch*','feature-*'] | |
paths: | |
- '**.sql' | |
workflow_dispatch: | |
permissions: read-all | |
env: | |
INFORMATIONAL_VERSION: "7.3" | |
BUILD_INCREMENTER: "-537" | |
AZURE_ARTIFACT_URL: "https://pkgs.dev.azure.com/ed-fi-alliance/Ed-Fi-Alliance-OSS/_packaging/EdFi/nuget/v3/index.json" | |
AZURE_ARTIFACT_NUGET_KEY: ${{ secrets.AZURE_ARTIFACTS_PERSONAL_ACCESS_TOKEN }} | |
VSS_NUGET_EXTERNAL_FEED_ENDPOINTS : '{"endpointCredentials": [{"endpoint": "https://pkgs.dev.azure.com/ed-fi-alliance/Ed-Fi-Alliance-OSS/_packaging/EdFi/nuget/v3/index.json","password": "${{ secrets.AZURE_ARTIFACTS_PERSONAL_ACCESS_TOKEN }}"}]}' | |
CONFIGURATION: "Release" | |
HEAD_REF: ${{ GITHUB.HEAD_REF }} | |
REF_NAME: ${{ GITHUB.REF_NAME }} | |
REPOSITORY_DISPATCH_BRANCH: ${{ github.event.client_payload.branch }} | |
REPOSITORY_OWNER: ${{ GITHUB.REPOSITORY_OWNER }} | |
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} | |
jobs: | |
FindStandardAndExtensionVersions: | |
uses: ./.github/workflows/Find Standard and Extension Versions.yml | |
with: | |
calling_branch: ${{ github.head_ref || github.ref_name }} | |
build: | |
if: ${{ always() }} | |
needs: FindStandardAndExtensionVersions | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
StandardVersion: ${{ fromJson(needs.FindStandardAndExtensionVersions.outputs.StandardVersions) }} | |
ExtensionVersion: ${{ fromJson(needs.FindStandardAndExtensionVersions.outputs.ExtensionVersions) }} | |
name: build (${{ matrix.StandardVersion }}, ${{ matrix.ExtensionVersion }}) | |
steps: | |
- name: Check for Azure token | |
if: ${{ env.REPOSITORY_OWNER == 'Ed-Fi-Alliance-OSS' && env.AZURE_ARTIFACT_NUGET_KEY == '' }} | |
run: | | |
echo "::error::Missing Azure Token" | |
exit 1 | |
- name: Support longpaths | |
run: git config --system core.longpaths true | |
- name: Checkout Ed-Fi-ODS | |
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 | |
with: | |
repository: Ed-Fi-Alliance-OSS/Ed-Fi-ODS | |
path: Ed-Fi-ODS/ | |
- name: Is pull request branch exists in Ed-Fi-ODS | |
working-directory: ./Ed-Fi-ODS/ | |
shell: powershell | |
run: | | |
.\build.githubactions.ps1 CheckoutBranch -RelativeRepoPath "." | |
- name: Checkout Ed-Fi-ODS-Implementation | |
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 | |
with: | |
repository: Ed-Fi-Alliance-OSS/Ed-Fi-ODS-Implementation | |
path: Ed-Fi-ODS-Implementation/ | |
- name: Is pull request branch exists in Ed-Fi-ODS-Implementation | |
working-directory: ./Ed-Fi-ODS/ | |
shell: powershell | |
run: | | |
.\build.githubactions.ps1 CheckoutBranch -RelativeRepoPath "../Ed-Fi-ODS-Implementation" | |
- name: update BUILD_INCREMENTER | |
run: | | |
$newRevision = ([int]${{ github.run_number }}) + ([int]${{env.BUILD_INCREMENTER}}) | |
if ($newRevision -lt 0) { | |
$newRevision = 1 | |
echo "BUILD_INCREMENTER=$newRevision">> $env:GITHUB_ENV | |
} | |
shell: pwsh | |
- name: Install sql-server-2019, sqlpackage, and postgres13 | |
shell: powershell | |
run: | | |
choco install sql-server-2019 -y --params "'/IGNOREPENDINGREBOOT /IACCEPTSQLSERVERLICENSETERMS /Q /ACTION=install /INSTANCEID=MSSQLSERVER /INSTANCENAME=MSSQLSERVER /TCPENABLED=1 /UPDATEENABLED=FALSE /FEATURES=SQL,Tools'" --execution-timeout=$installTimeout | |
choco install sqlpackage | |
choco install postgresql16 --params '/Password:${{ env.POSTGRES_PASSWORD }}' | |
$confPath = "C:\Program Files\PostgreSQL\16\data\pg_hba.conf" | |
(Get-Content $confPath).Replace("scram-sha-256","trust") | Set-Content $confPath | |
Restart-Service postgresql-x64-16 | |
- name: Create Security Database | |
shell: powershell | |
run: | | |
$ErrorActionPreference = 'Stop' | |
$PSVersionTable | |
. $env:GITHUB_WORKSPACE/Ed-Fi-ODS-Implementation/logistics/scripts/activities/build/create-database-package.ps1 -Output NugetPackages -DatabaseType Security -ExtensionVersion ${{ matrix.ExtensionVersion }} -StandardVersion ${{ matrix.StandardVersion }} -SQLPackage "C:\ProgramData\chocolatey\lib\sqlpackage\tools" | |
- name: Use NuGet | |
uses: nuget/setup-nuget@b2bc17b761a1d88cab755a776c7922eb26eefbfa # v1 | |
with: | |
nuget-version: '5.x' | |
- name: Create NuGet package | |
shell: powershell | |
run: | | |
[int]$BuildCounter = "${{ github.run_number }}" | |
[int]$BuildIncrementer = "${{ env.BUILD_INCREMENTER }}" | |
[int]$newRevision = $BuildCounter + $BuildIncrementer | |
[string]$version = "${{env.INFORMATIONAL_VERSION}}"+ "." + $newRevision.ToString() | |
$packageOutput = "$env:GITHUB_WORKSPACE/Ed-Fi-ODS/NugetPackages" | |
$SecurityNuspecFilePath = "$env:GITHUB_WORKSPACE/NugetPackages/EdFi.Database.Security.Standard.${{ matrix.StandardVersion }}.nuspec" | |
$SecurityBACPACNuspecFilePath = "$env:GITHUB_WORKSPACE/NugetPackages/EdFi.Database.Security.BACPAC.Standard.${{ matrix.StandardVersion }}.nuspec" | |
$SecurityPostgreSQLNuspecFilePath = "$env:GITHUB_WORKSPACE/NugetPackages/EdFi.Database.Security.PostgreSQL.Standard.${{ matrix.StandardVersion }}.nuspec" | |
nuget pack $SecurityNuspecFilePath -OutputDirectory $packageOutput -Version $version -Properties "configuration=release" -Properties "authors=Ed-Fi Alliance" -Properties "owners=Ed-Fi Alliance" -Properties "copyright=Copyright © $(date +'%Y') Ed-Fi Alliance, LLC and Contributors" -NoPackageAnalysis -NoDefaultExcludes | |
nuget pack $SecurityBACPACNuspecFilePath -OutputDirectory $packageOutput -Version $version -Properties "configuration=release" -Properties "authors=Ed-Fi Alliance" -Properties "owners=Ed-Fi Alliance" -Properties "copyright=Copyright © $(date +'%Y') Ed-Fi Alliance, LLC and Contributors" -NoPackageAnalysis -NoDefaultExcludes | |
nuget pack $SecurityPostgreSQLNuspecFilePath -OutputDirectory $packageOutput -Version $version -Properties "configuration=release" -Properties "authors=Ed-Fi Alliance" -Properties "owners=Ed-Fi Alliance" -Properties "copyright=Copyright © $(date +'%Y') Ed-Fi Alliance, LLC and Contributors" -NoPackageAnalysis -NoDefaultExcludes | |
- name: Install-credential-handler | |
if: ${{ env.AZURE_ARTIFACT_NUGET_KEY != '' && github.event_name == 'workflow_dispatch' }} | |
working-directory: ./Ed-Fi-ODS/ | |
run: | | |
.\build.githubactions.ps1 InstallCredentialHandler | |
shell: powershell | |
- name: Publish Nuget package | |
working-directory: ./Ed-Fi-ODS/ | |
if: ${{ env.AZURE_ARTIFACT_NUGET_KEY != '' && github.event_name == 'workflow_dispatch' }} | |
run: | | |
.\build.githubactions.ps1 publish -InformationalVersion ${{ env.INFORMATIONAL_VERSION }} -BuildCounter ${{ github.run_number }} -BuildIncrementer ${{env.BUILD_INCREMENTER}} -NuGetApiKey ${{ env.AZURE_ARTIFACT_NUGET_KEY }} -EdFiNuGetFeed ${{env.AZURE_ARTIFACT_URL}} -PackageName "EdFi.Database.Security.Standard.${{ matrix.StandardVersion }}" | |
.\build.githubactions.ps1 publish -InformationalVersion ${{ env.INFORMATIONAL_VERSION }} -BuildCounter ${{ github.run_number }} -BuildIncrementer ${{env.BUILD_INCREMENTER}} -NuGetApiKey ${{ env.AZURE_ARTIFACT_NUGET_KEY }} -EdFiNuGetFeed ${{env.AZURE_ARTIFACT_URL}} -PackageName "EdFi.Database.Security.BACPAC.Standard.${{ matrix.StandardVersion }}" | |
.\build.githubactions.ps1 publish -InformationalVersion ${{ env.INFORMATIONAL_VERSION }} -BuildCounter ${{ github.run_number }} -BuildIncrementer ${{env.BUILD_INCREMENTER}} -NuGetApiKey ${{ env.AZURE_ARTIFACT_NUGET_KEY }} -EdFiNuGetFeed ${{env.AZURE_ARTIFACT_URL}} -PackageName "EdFi.Database.Security.PostgreSQL.Standard.${{ matrix.StandardVersion }}" | |
shell: powershell | |
- name: Upload EdFi.Database.Security Artifacts | |
if: success() | |
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 | |
with: | |
name: NugetPackages.Artifacts-${{ matrix.StandardVersion }} | |
path: ${{ github.workspace }}/Ed-Fi-ODS/NugetPackages/*.nupkg |