[TPDMDEV-798] Improve Workflow Permissions #202
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 Educator Preparation Model | |
on: | |
push: | |
workflow_dispatch: | |
inputs: | |
data_model_version: | |
type: string | |
description: "data_model_version: The data standard version corresponding to the Ed-Fi Model branch. Default: 5.1.0" | |
ODS_version: | |
type: string | |
description: "ODS_version: The Ed-Fi ODS/API version corresponding to the Ed-Fi Model branch. Default: 7.2" | |
tpdm_version: | |
type: string | |
description: "tpdm_version: The TPDM version being built. Default: 1.2.0" | |
ed_fi_model_ref: | |
type: string | |
description: "ed_fi_model_ref: The reference name from the Ed-Fi Model repo to pull. Default: DS-5.1-ME-3.x" | |
pull_request: | |
permissions: read-all | |
env: | |
data_model_version: "5.1.0" | |
ODS_version: "7.2" | |
tpdm_version: "1.2.0" | |
ed_fi_model_ref: "DS-5.1-ME-3.x" | |
node_version: "18" | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- name: Set env variables | |
run: | | |
if ("${{ github.event.inputs.data_model_version }}" -ne "") { | |
echo "data_model_version=${{ github.event.inputs.data_model_version }}" >> $env:GITHUB_ENV } | |
if ("${{ github.event.inputs.ODS_version }}" -ne "") { | |
echo "ODS_version=${{ github.event.inputs.ODS_version }}" >> $env:GITHUB_ENV } | |
if ("${{ github.event.inputs.tpdm_version }}" -ne "") { | |
echo "tpdm_version=${{ github.event.inputs.tpdm_version }}" >> $env:GITHUB_ENV } | |
if ("${{ github.event.inputs.ed_fi_model_ref }}" -ne "") { | |
echo "ed_fi_model_ref=${{ github.event.inputs.ed_fi_model_ref }}" >> $env:GITHUB_ENV} | |
- name: Git long filename support | |
run: git config --system core.longpaths true | |
- name: Checkout MetaEd-js repo | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c | |
with: | |
repository: Ed-Fi-Closed/MetaEd-js | |
token: ${{secrets.EDFI_BUILD_AGENT_PAT }} | |
path: MetaEd | |
- name: Checkout TPM-Community-Model repo | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c | |
with: | |
path: MetaEdExtensionSource | |
- name: Checkout Ed-Fi Model repo | |
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c | |
with: | |
repository: Ed-Fi-Closed/Ed-Fi-Model | |
token: ${{secrets.EDFI_BUILD_AGENT_PAT }} | |
ref: ${{ env.ed_fi_model_ref }} | |
path: Ed-Fi-Model | |
- name: Install NPM Packages | |
run: npm install | |
working-directory: MetaEd | |
- name: Build MetaEd | |
run: npm run build | |
working-directory: MetaEd | |
- name: Create MetaEd config | |
run: | | |
$OutputFolder = "${{ github.workspace }}\MetaEdOutput" | |
if (-not (Test-Path $OutputFolder)) { | |
New-Item $OutputFolder -ItemType Directory | |
} | |
$DeployFolder = "${{ github.workspace }}\MetaEdDeploy\Ed-Fi-ODS-Implementation\Application\EdFi.Ods.Extensions.TPDM" | |
if (-not (Test-Path $DeployFolder)) { | |
New-Item $DeployFolder -ItemType Directory | |
} | |
$MetaEdConfigBase = @{} | |
$emptyList = New-Object System.Collections.ArrayList | |
$projectPaths = New-Object System.Collections.ArrayList | |
$projectPaths.Add("${{ github.workspace }}\Ed-Fi-Model") | |
$projectPaths.Add("${{ github.workspace }}\MetaEdExtensionSource") | |
$projectList = New-Object System.Collections.ArrayList | |
$projectList.Add(@{"namespaceName"="EdFi";"projectName"="Ed-Fi";"projectVersion"="${{ env.data_model_version }}";"projectExtension"="";"description"="The Ed-Fi Data Model ${{ env.data_model_version }}";}) | |
$projectList.Add(@{"namespaceName"="TPDM";"projectName"="TPDM";"projectVersion"="${{ env.tpdm_version }}";"projectExtension"="EXTENSION";"description"="TPDM-Community";}) | |
$metaEdConfiguration = @{ | |
"artifactDirectory"="$OutputFolder"; | |
"deployDirectory"="${{ github.workspace }}\MetaEdDeploy"; | |
"pluginTechVersion"=@{}; | |
"projects"=$projectList; | |
"projectPaths"=$projectPaths; | |
"pluginConfigDirectories"=$emptyList; | |
"defaultPluginTechVersion"="${{ env.ODS_version }}.0"; | |
"allianceMode"=$true; | |
} | |
$MetaEdConfigBase.Add("metaEdConfiguration",$metaEdConfiguration) | |
Write-Host $metaEdConfiguration | |
$FilePath = 'MetaEd/build/MetaEdConfig-API-${{ env.ODS_version }}-DS-${{ env.data_model_version }}.json' | |
$MetaEdConfigBase | ConvertTo-Json -Depth 100 | Out-File -FilePath $FilePath -NoNewline -Encoding Ascii | |
- name: MetaEd - Build TPDM-Community | |
run: | | |
node ./index.js --config ./MetaEdConfig-API-${{ env.ODS_version }}-DS-${{ env.data_model_version }}.json -a | |
working-directory: MetaEd/build | |
- name: MetaEd - Deploy TPDM-Community | |
run: | | |
node index.js -a -c ../../../build/MetaEdConfig-API-${{ env.ODS_version }}-DS-${{ env.data_model_version }}.json | |
working-directory: MetaEd/packages/metaed-odsapi-deploy-console/dist | |
- name: Upload artifact | |
uses: actions/upload-artifact@e448a9b857ee2131e752b06002bf0e093c65e571 | |
with: | |
name: Extensions.TPDM.Community.${{ env.tpdm_version }}.${{ env.ODS_version }}.Standard.${{ env.data_model_version }} | |
path: MetaEdDeploy/Ed-Fi-ODS-Implementation/Application/EdFi.Ods.Extensions.TPDM/ |