Skip to content

Commit baa0a03

Browse files
committed
v0.5.2
1 parent 588abe3 commit baa0a03

14 files changed

Lines changed: 2818 additions & 175 deletions

.dockerignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
*
2+
3+
!manifest.webmanifest
4+
!sw.js
5+
6+
!*.html
7+
!*.png
8+
!*.svg
9+
!*.xml
10+
11+
!audio
12+
!css
13+
!data
14+
!fonts
15+
!icon
16+
!image
17+
!img
18+
!js
19+
!lib
20+
!pdf
21+
!search

.github/add-query-strings.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
if [[ $# -eq 0 ]]; then
6+
echo "No arguments provided. Usage: add-query-strings.sh <version>"
7+
exit 1
8+
fi
9+
10+
version=$1
11+
12+
# Set the IS_DEPLOYED variable for production.
13+
sed -i 's/IS_DEPLOYED\s*=\s*undefined/IS_DEPLOYED='"\"${version}\""'/g' js/utils.js
14+
15+
16+
echo "Installing Query Strings."
17+
18+
# JS files
19+
for file in js/*; do
20+
find . -maxdepth 1 -type f -name '*.html' -print0 |
21+
while IFS= read -r -d $'\0' line; do
22+
sed -i -e "s;$file;$file?v=${version};g" $line
23+
done
24+
done
25+
26+
# Handle the unique service worker .js strings
27+
find . -maxdepth 1 -type f -name '*.html' -print0 |
28+
while IFS= read -r -d $'\0' line; do
29+
sed -i -e "s;/sw.js;/sw.js?v=${version};g" $line
30+
done
31+
32+
# CSS files
33+
for file in css/*; do
34+
find . -maxdepth 1 -type f -name '*.html' -print0 |
35+
while IFS= read -r -d $'\0' line; do
36+
sed -i -e "s;$file;$file?v=${version};g" $line
37+
done
38+
done

.github/set-deployed-flag.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
if [[ $# -eq 0 ]]; then
6+
echo "No arguments provided. Usage: set-deployed-flag.sh <version>"
7+
exit 1
8+
fi
9+
10+
version=$1
11+
12+
# Set the IS_DEPLOYED variable for production.
13+
sed -i 's/IS_DEPLOYED\s*=\s*undefined/IS_DEPLOYED='"\"${version}\""'/g' js/utils.js
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Build and Deploy
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v**'
7+
8+
env:
9+
# See: https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#upgrading-a-workflow-that-accesses-ghcrio
10+
IMAGE_NAME: pf2etools
11+
12+
jobs:
13+
build-and-deploy:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@master
17+
18+
# See: https://stackoverflow.com/a/58178121
19+
- name: Set Env
20+
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
21+
22+
- name: Archive Release
23+
run: |
24+
zip -r pf2ools-${{ env.RELEASE_VERSION }}.zip . -x '*.git*' '*node_modules*' '*.github*' '*img*' '*.editorconfig*' '*CNAME*'
25+
- name: Set Deployed Flag
26+
run: |
27+
bash ./.github/set-deployed-flag.sh ${{ env.RELEASE_VERSION }}
28+
# Remove entries from the `.gitignore` so the gh-pages action can correctly add+commit them to the pages branch
29+
- name: Build Service Worker
30+
run: |
31+
node --version
32+
npm --version
33+
npm i
34+
npm run build:sw:prod
35+
sed -i 's/sw.js//g' .gitignore
36+
sed -i 's/sw-injector.js//g' .gitignore
37+
- name: Build SEO Pages
38+
env:
39+
VET_BASE_SITE_URL: https://pf2etools.com/
40+
VET_SEO_IS_SKIP_UA_ETC: true
41+
run: |
42+
npm run build:seo -- ${{ env.RELEASE_VERSION }}
43+
# See: https://github.com/JamesIves/github-pages-deploy-action
44+
- name: Deploy
45+
uses: JamesIves/github-pages-deploy-action@releases/v4
46+
with:
47+
branch: prod
48+
folder: .
49+
50+
- name: Archive Images
51+
run: |
52+
zip -r -s 500m img-${{ env.RELEASE_VERSION }}.zip img/
53+
- name: Upload Release
54+
# Add the files one-by-one in an effort to avoid timeouts
55+
run: |
56+
hub release create -a pf2ools-${{ env.RELEASE_VERSION }}.zip -m ${{ env.RELEASE_VERSION }} ${{ env.RELEASE_VERSION }}
57+
for f in $(find . -name 'img-${{ env.RELEASE_VERSION }}.*' -print); do hub release edit ${{ env.RELEASE_VERSION }} -m '' -a $f; done
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
61+
# region See: https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#upgrading-a-workflow-that-accesses-ghcrio
62+
- name: Build Image
63+
run: |
64+
docker build -t $IMAGE_NAME .
65+
- name: Log In to Registry
66+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
67+
68+
- name: Push Image
69+
run: |
70+
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
71+
# Change all uppercase to lowercase
72+
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
73+
# Strip git ref prefix from version
74+
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
75+
# Strip "v" prefix from tag name
76+
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
77+
echo IMAGE_ID=$IMAGE_ID
78+
echo VERSION=$VERSION
79+
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
80+
# Always tag latest when pushing a tag, as we don't expect to ever merge old tags
81+
[[ "${{ github.ref }}" == "refs/tags/"* ]] && docker tag $IMAGE_NAME $IMAGE_ID:latest
82+
docker push $IMAGE_ID:$VERSION
83+
docker push $IMAGE_ID:latest
84+
# endregion

.github/workflows/build.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM dragas/thttpd
2+
3+
COPY . ./

data/changelog.json

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
{
4141
"ver": "0.1.5",
4242
"date": "2022-02-13",
43-
"txt": "- Fix BUG-70, 71 and 72\n- (Fixed Typos/Added Tags)"
43+
"txt": "- Fixed BUG-70, 71 and 72\n- (Fixed Typos/Added Tags)"
4444
},
4545
{
4646
"ver": "0.1.6",
@@ -62,7 +62,7 @@
6262
"ver": "0.3.0",
6363
"title": "Random Access Memories",
6464
"date": "2022-03-23",
65-
"txt": "- Started Changelogs!\n- Removed nonsensical heightened data\n- Improved Initiative Tracker conditions menu\n- Added Combo Weapons from Guns & Gears\n- Converted all baseitems into new data structure\n- Changed the default Calendar in GM Screen to the Golarion calendar\n- Add full-page \"pf2-sidebar\" styles and \"entries\" entry\n- Added FEAT-96 and 102\n- Fixed archetype extra feats not being filtered correctly\n- Fix the patreon banner loading half of Patreon with it\n- Fixed BUG-86 and 87\n- Added gtags analytics\n- Add Lost Omens: World Guide to the Books page\n- Updated the navbar\n- Added a script to replace statblock references upon deployment\n- (Fixed Typos/Added Tags)"
65+
"txt": "- Started Changelogs!\n- Removed nonsensical heightened data\n- Improved Initiative Tracker conditions menu\n- Added Combo Weapons from Guns & Gears\n- Converted all baseitems into new data structure\n- Changed the default Calendar in GM Screen to the Golarion calendar\n- Add full-page \"pf2-sidebar\" styles and \"entries\" entry\n- Added FEAT-96 and 102\n- Fixed archetype extra feats not being filtered correctly\n- Fixed the patreon banner loading half of Patreon with it\n- Fixed BUG-86 and 87\n- Added gtags analytics\n- Add Lost Omens: World Guide to the Books page\n- Updated the navbar\n- Added a script to replace statblock references upon deployment\n- (Fixed Typos/Added Tags)"
6666
},
6767
{
6868
"ver": "0.3.1",
@@ -83,12 +83,12 @@
8383
{
8484
"ver": "0.4.1",
8585
"date": "2022-06-04",
86-
"txt": "- Fix a _copy bug"
86+
"txt": "- Fixed a _copy bug"
8787
},
8888
{
8989
"ver": "0.4.2",
9090
"date": "2022-06-04",
91-
"txt": "- Fix Items page price filter and expand it\n- (Typos/Tags)"
91+
"txt": "- Fixed Items page price filter and expand it\n- (Typos/Tags)"
9292
},
9393
{
9494
"ver": "0.5.0",
@@ -98,7 +98,12 @@
9898
{
9999
"ver": "0.5.1",
100100
"date": "2022-06-12",
101-
"txt": "- Fix Text Converter breaking on Feats without any actions attached\n- Start work on Strength of Thousands: Hurricane's Howl\n- (Typos/Tags)"
101+
"txt": "- Fixed Text Converter breaking on Feats without any actions attached\n- Start work on Strength of Thousands: Hurricane's Howl\n- (Typos/Tags)"
102+
},
103+
{
104+
"ver": "0.5.2",
105+
"date": "2022-06-12",
106+
"txt": "- Updated the production and release scripts with the mothersite, including Docker containers\n - Hopefully fixed serviceworker on production"
102107
}
103108
]
104109
}

js/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ if (typeof module !== "undefined") require("./parser.js");
55

66
// in deployment, `IS_DEPLOYED = "<version number>";` should be set below.
77
IS_DEPLOYED = undefined;
8-
VERSION_NUMBER = /* PF2ETOOLS_VERSION__OPEN */"0.5.0"/* PF2ETOOLS_VERSION__CLOSE */;
8+
VERSION_NUMBER = /* PF2ETOOLS_VERSION__OPEN */"0.5.2"/* PF2ETOOLS_VERSION__CLOSE */;
99
DEPLOYED_STATIC_ROOT = ""; // ""; // FIXME re-enable this when we have a CDN again
1010
IS_VTT = false;
1111

0 commit comments

Comments
 (0)