Skip to content

Commit 611c065

Browse files
committed
next attempt to fix strange website deployment permission issues
1 parent 53c2985 commit 611c065

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

.github/workflows/build.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ on:
55
branches:
66
- main
77

8-
permissions:
9-
contents: write
10-
118
jobs:
129
build:
1310
runs-on: ubuntu-latest

scripts/filterPdf.sh

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,22 @@ set -o nounset # set -u : exit the script if you try to use an uninitialized v
99
set -o errexit # set -e : exit the script if any statement returns a non-true return value
1010

1111
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Welcome to the pdf filtering script."
12-
fileIn="$1"
12+
13+
currentDir="$(pwd)"
14+
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): We are working in directory: '$currentDir'."
15+
16+
fileIn="$(readlink -f "$1")"
17+
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): The full input document path is '$fileIn'."
18+
1319
fileOut="$2"
20+
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): We will filter the input document '$fileIn' to '$fileOut'."
1421

15-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): We will filter '$fileIn' to '$fileOut using ghostscript."
22+
tempDir="$(mktemp -d)"
23+
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): We will use the temporary directory '$tempDir'."
1624

17-
tempFileSrc="$(mktemp)"
25+
cd "$tempDir"
26+
27+
tempFileSrc="$(mktemp --tmpdir="$tempDir")"
1828
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): We will first copy '$fileIn' to '$tempFileSrc'."
1929
cp "$fileIn" "$tempFileSrc"
2030
fileSize="$(stat -c%s "$tempFileSrc")"
@@ -24,7 +34,7 @@ cycle=0
2434
while :
2535
do
2636
cycle=$((cycle+1))
27-
tempFileDst="$(mktemp)"
37+
tempFileDst="$(mktemp --tmpdir="$tempDir")"
2838
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Now beginning filter cycle $cycle with destination '$tempFileDst'."
2939

3040
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): We ghostscript to filter '$tempFileSrc' to '$tempFileDst'."
@@ -104,6 +114,10 @@ do
104114
done
105115

106116
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Now moving '$tempFileSrc' to '$fileOut'."
117+
cd "$currentDir"
107118
mv "$tempFileSrc" "$fileOut"
108119

120+
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Now cleaning up '$tempDir'."
121+
rm -rf "$tempDir"
122+
109123
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Successfully finished filtering '$fileIn' to '$fileOut using ghostscript."

scripts/website.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Now minifying website."
6363
find -type f -name "*.html" -exec "$PYTHON_INTERPRETER" -c "print('{}');import minify_html;f=open('{}','r');s=f.read();f.close();s=minify_html.minify(s,do_not_minify_doctype=True,ensure_spec_compliant_unquoted_attribute_values=True,keep_html_and_head_opening_tags=False,minify_css=True,minify_js=True,remove_bangs=True,remove_processing_instructions=True);f=open('{}','w');f.write(s);f.close()" \;
6464
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Done minifying website."
6565

66+
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Setting permissions of '$websiteDir' and everything below to 777."
67+
chmod -R 777 "$websiteDir"
68+
6669
cd "$currentDir"
6770

6871
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): The website building script has successfully completed."

0 commit comments

Comments
 (0)