Skip to content

Merge pull request #142 from EverseDevelopment/develop #241

Merge pull request #142 from EverseDevelopment/develop

Merge pull request #142 from EverseDevelopment/develop #241

name: Deploy to Production
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup .NET Core 3.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x
- name: Setup .NET Core 8.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.9.7
with:
versionSpec: '5.5.0'
- name: Determine Version
uses: gittools/actions/gitversion/execute@v0.9.7
with:
useConfigFile: true
configFilePath: GitVersion.yml
id: gitversion
- name: Calculate Version
run: |
$currentVersion = "${{ steps.gitversion.outputs.Major }}.${{ steps.gitversion.outputs.Minor }}.${{ steps.gitversion.outputs.Patch }}"
$runNumber = ${{ github.run_number }}
$versionArray = $currentVersion.Split('.')
$newPatch = [int]$versionArray[2] + $runNumber
$newMinor = [int]$versionArray[1]
$newMajor = [int]$versionArray[0]
$newVersion = "$newMajor.$newMinor.$newPatch"
echo "FULL_VERSION=$newVersion" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
shell: pwsh
- name: Use environment variable
run: echo "The value of the FULL_VERSION is $env:FULL_VERSION"
- name: Setup MSBuild Path
uses: microsoft/setup-msbuild@v1.1
- name: Uninstall default WiX Toolset
run: |
choco uninstall wixtoolset
- name: Install specific version of WiX Toolset
run: |
choco install wixtoolset --version=3.11.2
- name: Get certificate
run: |
$url = "${{ secrets.EVERSE_CERTIFICATE_S3_URL }}"
$outputFilePath = "$GITHUB_WORKSPACE/credentials.pfx"
$apiKey = "${{ secrets.EVERSE_AWS_S3_CERTIFICATE_KEY_ID }}"
$headers = @{
"x-api-key" = $apiKey
}
Invoke-RestMethod -Uri $url -Headers $headers -OutFile $outputFilePath
- name: define certfificate key
run: |
echo "CERTIFICATE_KEY=${{ secrets.EVERSE_CERTIFICATE_KEY }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
shell: pwsh
- name: define certfificate location
run: |
echo "CERTIFICATE_LOCATION=$GITHUB_WORKSPACE/credentials.pfx" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
shell: pwsh
- name: Setup NuGet
uses: NuGet/setup-nuget@v1.0.6
- name: Restore NuGet Packages
run: nuget restore Revit_glTF_Exporter.sln
- name: Setting new version to the config file
run: |
(Get-Content Common_glTF_Exporter/Utils/SettingsConfig.cs) -replace '0.0.0', $env:FULL_VERSION | Out-File -encoding ASCII Common_glTF_Exporter/Utils/SettingsConfig.cs
- name: Configuring Key
run: |
$apiUrlKey = "${{ secrets.EVERSE_GLTF_EXPORTER_APIKEY }}"
(Get-Content Common_glTF_Exporter/Utils/SettingsConfig.cs) -replace 'PlaceHolderApiKey', $apiUrlKey | Out-File -encoding ASCII Common_glTF_Exporter/Utils/SettingsConfig.cs
shell: pwsh
- name: Setting new version to the AssemblyInfo 2019
run: |
(Get-Content Revit_glTF_Exporter_2019/Properties/AssemblyInfo.cs) -replace '1.0.0', $env:FULL_VERSION | Out-File -encoding ASCII Revit_glTF_Exporter_2019/Properties/AssemblyInfo.cs
- name: Setting new version to the AssemblyInfo 2020
run: |
(Get-Content Revit_glTF_Exporter_2020/Properties/AssemblyInfo.cs) -replace '1.0.0', $env:FULL_VERSION | Out-File -encoding ASCII Revit_glTF_Exporter_2020/Properties/AssemblyInfo.cs
- name: Setting new version to the AssemblyInfo 2021
run: |
(Get-Content Revit_glTF_Exporter_2021/Properties/AssemblyInfo.cs) -replace '1.0.0', $env:FULL_VERSION | Out-File -encoding ASCII Revit_glTF_Exporter_2021/Properties/AssemblyInfo.cs
- name: Setting new version to the AssemblyInfo 2022
run: |
(Get-Content Revit_glTF_Exporter_2022/Properties/AssemblyInfo.cs) -replace '1.0.0', $env:FULL_VERSION | Out-File -encoding ASCII Revit_glTF_Exporter_2022/Properties/AssemblyInfo.cs
- name: Setting new version to the AssemblyInfo 2023
run: |
(Get-Content Revit_glTF_Exporter_2023/Properties/AssemblyInfo.cs) -replace '1.0.0', $env:FULL_VERSION | Out-File -encoding ASCII Revit_glTF_Exporter_2023/Properties/AssemblyInfo.cs
- name: Setting new version to the AssemblyInfo 2024
run: |
(Get-Content Revit_glTF_Exporter_2024/Properties/AssemblyInfo.cs) -replace '1.0.0', $env:FULL_VERSION | Out-File -encoding ASCII Revit_glTF_Exporter_2024/Properties/AssemblyInfo.cs
- name: Setting new version to the AssemblyInfo 2025
run: |
(Get-Content Revit_glTF_Exporter_2025/Revit_glTF_Exporter_2025.csproj) -replace '1.0.0', $env:FULL_VERSION | Out-File -encoding ASCII Revit_glTF_Exporter_2025/Revit_glTF_Exporter_2025.csproj
- name: Setting new version to the AssemblyInfo 2026
run: |
(Get-Content Revit_glTF_Exporter_2026/Revit_glTF_Exporter_2026.csproj) -replace '1.0.0', $env:FULL_VERSION | Out-File -encoding ASCII Revit_glTF_Exporter_2026/Revit_glTF_Exporter_2026.csproj
- name: Setting versions in PackageContents
run: |
(Get-Content Common_glTF_Exporter/PackageContents.xml) -replace '1.0.0', $env:FULL_VERSION | Out-File -encoding ASCII Common_glTF_Exporter/PackageContents.xml
- name: Configuring API URL
run: |
$apiUrl = "${{ secrets.EVERSE_GLTF_EXPORTER_APIURL }}"
(Get-Content Common_glTF_Exporter/Utils/Analytics.cs) -replace 'https://expoterAPI', $apiUrl | Out-File -encoding ASCII Common_glTF_Exporter/Utils/Analytics.cs
shell: pwsh
- name: Configuring AutoUpdate URL
run: |
$apiAutoUpdate = "${{ secrets.EVERSE_AUTOUPDATE_ADDINS_URL }}"
(Get-Content Common_glTF_Exporter/Version/LatestVersion.cs) -replace 'https://APIAutoUpdate', $apiAutoUpdate | Out-File -encoding ASCII Common_glTF_Exporter/Version/LatestVersion.cs
shell: pwsh
- name: Replace strings in the code
run: |
(Get-Content GltfInstaller/Program.cs) -replace '0.0.0', $env:FULL_VERSION | Out-File -encoding ASCII GltfInstaller/Program.cs
- name: Configuring ClickupEndpoint
run: |
$apiUrl = "${{ secrets.EVERSE_LEIA_Clickup }}"
(Get-Content Common_glTF_Exporter/Utils/ClickUpFormSender.cs) -replace 'ClickupEndPoint', $apiUrl | Out-File -encoding ASCII Common_glTF_Exporter/Utils/ClickUpFormSender.cs
shell: pwsh
- name: Build and Publish App
run: msbuild Revit_glTF_Exporter.sln /t:Clean,Build /p:platform="Any CPU" /p:Configuration=Release /p:DeployOnBuild=true /p:PublishProfile=FolderProfile
- name: Sign MSIs
run: |
$msis = Get-ChildItem -Path .\GltfInstaller\ -Filter "*.msi" -Recurse | ForEach-Object { $_.FullName }
foreach ($msi in $msis) {
& "C:\Users\runneradmin\.nuget\packages\signtool\10.0.17763.132\tools\signtool.exe" sign /f ${{ env.CERTIFICATE_LOCATION }} /p ${{ secrets.EVERSE_CERTIFICATE_KEY }} /t http://timestamp.digicert.com "$msi"
Write-Host $msi
}
shell: pwsh
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.FULL_VERSION }}
release_name: GLTF Exporter v${{ env.FULL_VERSION }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: .\GltfInstaller\Leia - glTF exporter ${{ env.FULL_VERSION }}.msi
asset_name: Leia-glTF exporter ${{ env.FULL_VERSION }}.msi
asset_content_type: application/zip
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.EVERSE_AWS_S3_BUCKET_SECRET_KEY_ID }}
aws-secret-access-key: ${{ secrets.EVERSE_AWS_S3_BUCKET_SECRET_KEY_SECRET }}
aws-region: us-east-1
- name: Upload file to S3
run: |
aws s3 cp ".\GltfInstaller\Leia - glTF exporter $env:FULL_VERSION.msi" "s3://${{ secrets.EVERSE_INSTALLER_BUCKET_NAME }}/e-verse/LeiaGltfExporter/" --debug