Skip to content

Commit

Permalink
Getting closer see #43
Browse files Browse the repository at this point in the history
  • Loading branch information
scharlton2 committed Apr 12, 2022
1 parent 73dec33 commit 8bc1793
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 11 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ^(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*)(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$
DIST_DIR: mvmf6-1.0.0 # automate this later

jobs:

Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions ModelViewer/ModelViewer.rc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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"
Expand Down
58 changes: 58 additions & 0 deletions misc/set_versions.ps1
Original file line number Diff line number Diff line change
@@ -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 '(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)(?:\.(?<patch>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 (?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)(?:\.(?<patch>0|[1-9]\d*))', "VERSION $next_version"
} | Set-Content $file

# sed ModelViewer.rc
$file = ".\ModelViewer\ModelViewer.rc"
(Get-Content $file) | Foreach-Object {
$_ -replace 'Version (?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)(?:\.(?<patch>0|[1-9]\d*))', "Version $next_version"`
-replace 'FILEVERSION (?<major>0|[1-9]\d*),(?<minor>0|[1-9]\d*),(?<patch>0|[1-9]\d*),(?<build>0|[1-9]\d*)', "FILEVERSION $fullversion_commas"`
-replace 'PRODUCTVERSION (?<major>0|[1-9]\d*),(?<minor>0|[1-9]\d*),(?<patch>0|[1-9]\d*),(?<build>0|[1-9]\d*)', "PRODUCTVERSION $fullversion_commas"`
-replace 'VALUE "FileVersion", "(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d)\.(?<patch>0|[1-9]\d*)\.(?<build>0|[1-9]\d*)"', "VALUE ""FileVersion"", ""$fullversion"""`
-replace 'VALUE "ProductVersion", "(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d)\.(?<patch>0|[1-9]\d*)\.(?<build>0|[1-9]\d*)"', "VALUE ""ProductVersion"", ""$fullversion"""`
-replace '"(?<month>[0-1][1-9])\/(?<day>[0-3][1-9])\/(?<year>\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

0 comments on commit 8bc1793

Please sign in to comment.