Skip to content

Commit c729fdd

Browse files
authored
Merge pull request #51 from usgs-coupled/49-move-phreeqc-chm-windows-git-to-github-actions
Added update html step
2 parents e15fb5f + 74cad02 commit c729fdd

File tree

2 files changed

+248
-85
lines changed

2 files changed

+248
-85
lines changed

.github/workflows/chm.yml

-85
This file was deleted.

.github/workflows/dist.yml

+248
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,248 @@
1+
name: dist
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- develop
8+
paths-ignore:
9+
- 'doc/**'
10+
- 'Version3/**'
11+
- 'README.md'
12+
pull_request:
13+
branches:
14+
- master
15+
- develop
16+
paths-ignore:
17+
- 'doc/**'
18+
- 'Version3/**'
19+
- 'README.md'
20+
schedule:
21+
- cron: '1 2 2/7 * *'
22+
workflow_dispatch:
23+
inputs:
24+
date:
25+
description: 'DATE: Leave blank to use todays date'
26+
required: false
27+
default: ''
28+
29+
rel:
30+
description: 'REL: Leave blank to automatically generate (2021-03-09 = 15700)'
31+
required: false
32+
default: ''
33+
34+
ver:
35+
description: 'VER: Leave blank to use MAJOR.MINOR.(PATCH+1) (from https://github.com/usgs-coupled/phreeqc-version/blob/main/phreeqc-version.txt)'
36+
required: false
37+
default: ''
38+
39+
jobs:
40+
41+
log-the-inputs:
42+
runs-on: ubuntu-latest
43+
steps:
44+
- run: |
45+
echo "Date: $DATE"
46+
echo "REL: $REL"
47+
echo "VER: $VER"
48+
env:
49+
DATE: ${{ inputs.date }}
50+
REL: ${{ inputs.rel }}
51+
VER: ${{ inputs.ver }}
52+
53+
init:
54+
if: github.event.pull_request.draft == false
55+
runs-on: ubuntu-latest
56+
env:
57+
DATE: ${{ inputs.date }}
58+
REL: ${{ inputs.rel }}
59+
VER: ${{ inputs.ver }}
60+
# Map step outputs to job outputs
61+
outputs:
62+
VER: ${{ steps.vars.outputs.VER }}
63+
REL: ${{ steps.vars.outputs.REL }}
64+
DATE: ${{ steps.vars.outputs.DATE }}
65+
DATE_FULL: ${{ steps.vars.outputs.DATE_FULL }}
66+
DATE_RFC_3339: ${{ steps.vars.outputs.DATE_RFC_3339 }}
67+
steps:
68+
- name: Setup vars
69+
id: vars
70+
run: |
71+
if [ -z "${VER}" ]; then
72+
echo VER="$(curl -sS https://raw.githubusercontent.com/usgs-coupled/phreeqc-version/main/next_ver.sh | sh)" >> "${GITHUB_OUTPUT}"
73+
else
74+
echo VER="${VER}" >> "${GITHUB_OUTPUT}"
75+
fi
76+
77+
if [ -z "${REL}" ]; then
78+
echo REL="$(curl -sS https://raw.githubusercontent.com/usgs-coupled/phreeqc-version/main/rel.py | python3)" >> "${GITHUB_OUTPUT}"
79+
else
80+
echo REL="${REL}" >> "${GITHUB_OUTPUT}"
81+
fi
82+
83+
if [ -z "${DATE}" ]; then
84+
echo DATE="$(TZ='America/Denver' date '+%x')" >> "${GITHUB_OUTPUT}"
85+
echo DATE_RFC_3339="$(TZ='America/Denver' date --rfc-3339=date)" >> "${GITHUB_OUTPUT}"
86+
echo DATE_FULL="$(TZ='America/Denver' date)" >> "${GITHUB_OUTPUT}"
87+
else
88+
echo DATE="${DATE}" >> "${GITHUB_OUTPUT}"
89+
echo DATE_RFC_3339="$(TZ='America/Denver' date --rfc-3339=date --date=${DATE})" >> "${GITHUB_OUTPUT}"
90+
echo DATE_FULL="$(TZ='America/Denver' date --date=${DATE})" >> "${GITHUB_OUTPUT}"
91+
fi
92+
93+
results:
94+
name: display results
95+
needs: init
96+
runs-on: ubuntu-latest
97+
steps:
98+
- name: results
99+
run: |
100+
echo VER="${{ needs.init.outputs.VER }}"
101+
echo REL="${{ needs.init.outputs.REL }}"
102+
echo DATE="${{ needs.init.outputs.DATE }}"
103+
echo DATE_RFC_3339="${{ needs.init.outputs.DATE_RFC_3339 }}"
104+
echo DATE_FULL="${{ needs.init.outputs.DATE_FULL }}"
105+
echo TARBALL="phreeqc-${{ needs.init.outputs.VER }}-${{ needs.init.outputs.REL }}.tar.gz"
106+
107+
build-chm:
108+
runs-on: windows-latest
109+
steps:
110+
111+
- name: '🧰 Checkout'
112+
uses: actions/checkout@v4
113+
114+
- name: 'fixup_html'
115+
shell: bash
116+
working-directory: ${{ github.workspace }}/HTMLversion/HTML
117+
run: ./fixup_html.bash
118+
119+
- name: 'update html'
120+
shell: bash
121+
working-directory: ${{ github.workspace }}/HTMLversion
122+
run: tar czf ../HTML.tar.gz HTML/*.htm HTML/*.png HTML/*.css
123+
124+
- uses: actions/upload-artifact@v4
125+
with:
126+
name: HTML
127+
path: ${{github.workspace}}/HTML.tar.gz
128+
129+
- name: cache htmlhelp
130+
id: cache-htmlhelp
131+
uses: actions/cache@v4
132+
with:
133+
path: "C:/Program Files (x86)/HTML Help Workshop"
134+
key: ${{ runner.os }}-htmlhelp
135+
136+
- name: install htmlhelp
137+
if: steps.cache-htmlhelp.outputs.cache-hit != 'true'
138+
timeout-minutes: 5
139+
run: |
140+
curl -L -O --max-time 120 http://web.archive.org/web/20160201063255/http://download.microsoft.com/download/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe
141+
cmd /c start /wait .\htmlhelp.exe /q /c /t:$(Get-Location)\tmp
142+
$file = "$(Get-Location)\tmp\htmlhelp.inf"
143+
(Get-Content $file) | Foreach-Object { $_ `
144+
-replace '^BeginPrompt', ';;BeginPrompt' `
145+
-replace '^EndPrompt', ';;EndPrompt' `
146+
-replace '^49000=CustomLDID49000, 1', '49000=CustomLDID49000, 5' `
147+
-replace '^"hhupd.exe', ';;hhupd.exe' `
148+
-replace '^DefaultInstallDir="C:\\Program Files\\HTML Help Workshop"', 'DefaultInstallDir="%ProgramFiles%\\HTML Help Workshop"'
149+
} | Set-Content $file
150+
cmd /c start /wait .\tmp\setup.exe
151+
Remove-Item -Recurse -Force .\tmp
152+
Remove-Item -Recurse -Force .\htmlhelp.exe
153+
154+
- name: add htmlhelp to path
155+
run: Write-Output 'C:\Program Files (x86)\HTML Help Workshop' | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
156+
157+
- name: compile chm
158+
shell: bash
159+
working-directory: ${{ github.workspace }}/HTMLversion
160+
run: |
161+
# hhc returns 1 on success
162+
set +e
163+
hhc phreeqc3.hhp | tee hhc.out
164+
status=${PIPESTATUS[0]}
165+
set -e
166+
if [ "$status" -eq 1 ]; then
167+
echo "[OK]"
168+
exit 0
169+
else
170+
echo "[FAILED]"
171+
exit 1
172+
fi
173+
174+
- uses: actions/upload-artifact@v4
175+
with:
176+
name: chm
177+
path: ${{github.workspace}}/HTMLversion/phreeqc3.chm
178+
179+
distcheck:
180+
# if: ${{ false }}
181+
name: make distcheck
182+
needs: [init, build-chm]
183+
runs-on: ubuntu-latest
184+
185+
steps:
186+
- uses: actions/checkout@v4
187+
188+
- uses: actions/download-artifact@v4
189+
with:
190+
name: chm
191+
path: ${{github.workspace}}/HTMLversion
192+
193+
- uses: actions/download-artifact@v4
194+
with:
195+
name: HTML
196+
197+
- name: install dos2unix
198+
run: sudo apt-get -y install dos2unix
199+
200+
- name: versioning
201+
run: ./jenkins-phreeqc-dist.sh -v ${{ needs.init.outputs.VER }} -r ${{ needs.init.outputs.REL }} -d ${{ needs.init.outputs.DATE }}
202+
203+
- name: bootstrap
204+
run: ./bootstrap
205+
206+
- name: mkdir
207+
run: mkdir ${{github.workspace}}/_build
208+
209+
- name: configure
210+
working-directory: ${{github.workspace}}/_build
211+
run: ../configure --prefix=$(pwd)/INSTALL
212+
213+
- name: make distcheck
214+
working-directory: ${{github.workspace}}/_build
215+
run: DISTCHECK_CONFIGURE_FLAGS="" make -j2 distcheck
216+
217+
- name: copy README
218+
run: cp doc/README PHREEQC_ReadMe_Windows_and_Linux_Batch_Versions.txt
219+
220+
- name: convert line endings
221+
run: unix2dos doc/RELEASE doc/README
222+
223+
- name: copy RELEASE
224+
run: cp doc/RELEASE Phreeqc_ReleaseNotes.txt
225+
226+
- name: make dist-zip
227+
working-directory: ${{github.workspace}}/_build
228+
run: make dist-zip
229+
230+
- name: mv files
231+
working-directory: ${{github.workspace}}/_build
232+
run: mv *.tar.gz *.zip ../.
233+
234+
- uses: actions/upload-artifact@v4
235+
with:
236+
name: phreeqc-artifacts
237+
path: |
238+
phreeqc-*.tar.gz
239+
phreeqc-*.zip
240+
PHREEQC_ReadMe_Windows_and_Linux_Batch_Versions.txt
241+
Phreeqc_ReleaseNotes.txt
242+
HTML.tar.gz
243+
244+
- uses: geekyeggo/delete-artifact@v5
245+
with:
246+
name: |
247+
chm
248+
HTML

0 commit comments

Comments
 (0)