diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f7bc146..d5db06d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,6 +32,7 @@ env: VTK_6_3_0_VS2017_X64_URL: https://github.com/MODFLOW-USGS/modelviewer-mf6/releases/download/vtk-6.3.0-vs2017-x64/vtk-6.3.0-vs2017-x64.7z HTMLHELP_URL: http://web.archive.org/web/20160201063255/http://download.microsoft.com/download/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe SEM_VER_REGEX: ^(?0|[1-9]\d*)\.(?0|[1-9]\d*)\.(?0|[1-9]\d*)(?:-(?(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$ + DIST_DIR: mvmf6-1.0.0 # automate this later jobs: @@ -235,21 +236,15 @@ jobs: run: cmake --build --preset vs2019 --config release - name: Install - env: - DIST_DIR: mvmf6-1.0.0-rc.1 # automate this later shell: pwsh run: cmake --install _vs2019 --prefix ${{env.DIST_DIR}} --config release - name: Build mvmf6 zip - env: - DIST_DIR: mvmf6-1.0.0-rc.1 # automate this later run: | Copy-Item .\Help\mvmf6.chm ${{env.DIST_DIR}}\bin\. 7z a -tzip ${{env.DIST_DIR}}.zip .\${{env.DIST_DIR}}\ - name: Create artifact - env: - DIST_DIR: mvmf6-1.0.0-rc.1 # automate this later uses: actions/upload-artifact@v3 with: name: dist diff --git a/ModelViewer/ModelViewer.rc b/ModelViewer/ModelViewer.rc index b59cb00..15b32e5 100644 --- a/ModelViewer/ModelViewer.rc +++ b/ModelViewer/ModelViewer.rc @@ -770,7 +770,7 @@ BEGIN ICON IDR_MAINFRAME,IDC_STATIC,7,7,20,20 LTEXT "Model Viewer for Modflow 6",IDC_MV_VERSION,45,7,107,10,SS_NOPREFIX LTEXT "Version 1.0.0",IDC_STATIC,45,20,107,10 - LTEXT "04/12/2022 (compiled Apr 12 2022 12:12:39)",IDC_MV_RELEASE,45,33,128,8 + LTEXT "04/12/2022 (compiled Apr 12 2022 13:26:55)",IDC_MV_RELEASE,45,33,128,8 GROUPBOX "Notice",IDC_STATIC,7,47,204,49 LTEXT "This software uses the Visualization Toolkit (vtk), written and copyrighted by Ken Martin, Will Schroeder and Bill Lorensen. The authors of vtk have granted permission to use, copy, and distribute vtk while retaining their copyright. ",IDC_STATIC,15,59,191,34 GROUPBOX "Disclaimer",IDC_STATIC,7,98,204,119 @@ -1550,8 +1550,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,12,64 - PRODUCTVERSION 1,0,12,64 + FILEVERSION 1,0,0,77 + PRODUCTVERSION 1,0,0,77 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -1568,12 +1568,12 @@ BEGIN BEGIN VALUE "CompanyName", "USGS" VALUE "FileDescription", "Model Viewer for Modflow 6" - VALUE "FileVersion", "1.0.12.64" + VALUE "FileVersion", "1.0.0.77" VALUE "InternalName", "Model Viewer for Modflow 6" VALUE "LegalCopyright", "public domain" VALUE "OriginalFilename", "mvmf6.exe" VALUE "ProductName", "Model Viewer for Modflow 6" - VALUE "ProductVersion", "1.0.12.64" + VALUE "ProductVersion", "1.0.0.77" END END BLOCK "VarFileInfo" diff --git a/misc/set_versions.ps1 b/misc/set_versions.ps1 new file mode 100644 index 0000000..62b75bf --- /dev/null +++ b/misc/set_versions.ps1 @@ -0,0 +1,58 @@ +# create headers dictionary +# $h = @{"Authorization" = "token ${{secrets.GITHUB_TOKEN}}"} + +# try { +# $response = Invoke-WebRequest -Uri ${{env.RELEASES_URL}}/latest -Headers $h -Method GET +# $json = $response.Content | ConvertFrom-Json +# $tag_name = $json.tag_name +# } +# catch { +# # none so far +# $tag_name = "0.0" +# } + +# $next_version = "1.0.0" +# if ($tag_name -match '(?0|[1-9]\d*)\.(?0|[1-9]\d*)(?:\.(?0|[1-9]\d*))?$') { +# if ($Matches.ContainsKey('patch')) { +# $patch = 1 + $Matches['patch'] +# } +# else { +# $patch = 0 +# } +# $next_version = $Matches['major'] + "." + $Matches['minor'] + "." + $patch +# } + +# major.minor.patch.build + +##$build = ${{github.run_number}} +$next_version = "1.0.0" +$build = "77" + +$fullversion = "$next_version.$build" +$fullversion_commas = $fullversion.Replace(".", ",") +$date_compiled = "$((Get-Date -UFormat '%m/%d/%Y (compiled %b %d %Y %T)'))" + +# sed CMakeLists.txt +$file = ".\CMakeLists.txt" +(Get-Content $file) | Foreach-Object { + $_ -replace 'VERSION (?0|[1-9]\d*)\.(?0|[1-9]\d*)(?:\.(?0|[1-9]\d*))', "VERSION $next_version" +} | Set-Content $file + +# sed ModelViewer.rc +$file = ".\ModelViewer\ModelViewer.rc" +(Get-Content $file) | Foreach-Object { + $_ -replace 'Version (?0|[1-9]\d*)\.(?0|[1-9]\d*)(?:\.(?0|[1-9]\d*))', "Version $next_version"` + -replace 'FILEVERSION (?0|[1-9]\d*),(?0|[1-9]\d*),(?0|[1-9]\d*),(?0|[1-9]\d*)', "FILEVERSION $fullversion_commas"` + -replace 'PRODUCTVERSION (?0|[1-9]\d*),(?0|[1-9]\d*),(?0|[1-9]\d*),(?0|[1-9]\d*)', "PRODUCTVERSION $fullversion_commas"` + -replace 'VALUE "FileVersion", "(?0|[1-9]\d*)\.(?0|[1-9]\d)\.(?0|[1-9]\d*)\.(?0|[1-9]\d*)"', "VALUE ""FileVersion"", ""$fullversion"""` + -replace 'VALUE "ProductVersion", "(?0|[1-9]\d*)\.(?0|[1-9]\d)\.(?0|[1-9]\d*)\.(?0|[1-9]\d*)"', "VALUE ""ProductVersion"", ""$fullversion"""` + -replace '"(?[0-1][1-9])\/(?[0-3][1-9])\/(?\d{4}) \(.*\)"', """$date_compiled"""` +} | Set-Content $file + +# set env for remaining steps +if ($env:GITHUB_REPOSITORY -eq 'MODFLOW-USGS/modelviewer-mf6') { + Write-Output "DIST_DIR=mvmf6-$next_version" >> $env:GITHUB_ENV +} else { + Write-Output "DIST_DIR=mvmf6-$env:GITHUB_REPOSITORY_OWNER-$next_version" >> $env:GITHUB_ENV +} +Write-Output "NEXT_VERSION=$next_version" >> $env:GITHUB_ENV