Skip to content

Commit

Permalink
v0.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
MrVauxs committed Jun 12, 2022
1 parent 588abe3 commit baa0a03
Show file tree
Hide file tree
Showing 14 changed files with 2,818 additions and 175 deletions.
21 changes: 21 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
*

!manifest.webmanifest
!sw.js

!*.html
!*.png
!*.svg
!*.xml

!audio
!css
!data
!fonts
!icon
!image
!img
!js
!lib
!pdf
!search
38 changes: 38 additions & 0 deletions .github/add-query-strings.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash

set -e

if [[ $# -eq 0 ]]; then
echo "No arguments provided. Usage: add-query-strings.sh <version>"
exit 1
fi

version=$1

# Set the IS_DEPLOYED variable for production.
sed -i 's/IS_DEPLOYED\s*=\s*undefined/IS_DEPLOYED='"\"${version}\""'/g' js/utils.js


echo "Installing Query Strings."

# JS files
for file in js/*; do
find . -maxdepth 1 -type f -name '*.html' -print0 |
while IFS= read -r -d $'\0' line; do
sed -i -e "s;$file;$file?v=${version};g" $line
done
done

# Handle the unique service worker .js strings
find . -maxdepth 1 -type f -name '*.html' -print0 |
while IFS= read -r -d $'\0' line; do
sed -i -e "s;/sw.js;/sw.js?v=${version};g" $line
done

# CSS files
for file in css/*; do
find . -maxdepth 1 -type f -name '*.html' -print0 |
while IFS= read -r -d $'\0' line; do
sed -i -e "s;$file;$file?v=${version};g" $line
done
done
13 changes: 13 additions & 0 deletions .github/set-deployed-flag.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

set -e

if [[ $# -eq 0 ]]; then
echo "No arguments provided. Usage: set-deployed-flag.sh <version>"
exit 1
fi

version=$1

# Set the IS_DEPLOYED variable for production.
sed -i 's/IS_DEPLOYED\s*=\s*undefined/IS_DEPLOYED='"\"${version}\""'/g' js/utils.js
84 changes: 84 additions & 0 deletions .github/workflows/build&release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Build and Deploy

on:
push:
tags:
- 'v**'

env:
# 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
IMAGE_NAME: pf2etools

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master

# See: https://stackoverflow.com/a/58178121
- name: Set Env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Archive Release
run: |
zip -r pf2ools-${{ env.RELEASE_VERSION }}.zip . -x '*.git*' '*node_modules*' '*.github*' '*img*' '*.editorconfig*' '*CNAME*'
- name: Set Deployed Flag
run: |
bash ./.github/set-deployed-flag.sh ${{ env.RELEASE_VERSION }}
# Remove entries from the `.gitignore` so the gh-pages action can correctly add+commit them to the pages branch
- name: Build Service Worker
run: |
node --version
npm --version
npm i
npm run build:sw:prod
sed -i 's/sw.js//g' .gitignore
sed -i 's/sw-injector.js//g' .gitignore
- name: Build SEO Pages
env:
VET_BASE_SITE_URL: https://pf2etools.com/
VET_SEO_IS_SKIP_UA_ETC: true
run: |
npm run build:seo -- ${{ env.RELEASE_VERSION }}
# See: https://github.com/JamesIves/github-pages-deploy-action
- name: Deploy
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
branch: prod
folder: .

- name: Archive Images
run: |
zip -r -s 500m img-${{ env.RELEASE_VERSION }}.zip img/
- name: Upload Release
# Add the files one-by-one in an effort to avoid timeouts
run: |
hub release create -a pf2ools-${{ env.RELEASE_VERSION }}.zip -m ${{ env.RELEASE_VERSION }} ${{ env.RELEASE_VERSION }}
for f in $(find . -name 'img-${{ env.RELEASE_VERSION }}.*' -print); do hub release edit ${{ env.RELEASE_VERSION }} -m '' -a $f; done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# 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
- name: Build Image
run: |
docker build -t $IMAGE_NAME .
- name: Log In to Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Push Image
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
# Always tag latest when pushing a tag, as we don't expect to ever merge old tags
[[ "${{ github.ref }}" == "refs/tags/"* ]] && docker tag $IMAGE_NAME $IMAGE_ID:latest
docker push $IMAGE_ID:$VERSION
docker push $IMAGE_ID:latest
# endregion
44 changes: 0 additions & 44 deletions .github/workflows/build.yml

This file was deleted.

29 changes: 0 additions & 29 deletions .github/workflows/release.yml

This file was deleted.

3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM dragas/thttpd

COPY . ./
15 changes: 10 additions & 5 deletions data/changelog.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
{
"ver": "0.1.5",
"date": "2022-02-13",
"txt": "- Fix BUG-70, 71 and 72\n- (Fixed Typos/Added Tags)"
"txt": "- Fixed BUG-70, 71 and 72\n- (Fixed Typos/Added Tags)"
},
{
"ver": "0.1.6",
Expand All @@ -62,7 +62,7 @@
"ver": "0.3.0",
"title": "Random Access Memories",
"date": "2022-03-23",
"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)"
"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)"
},
{
"ver": "0.3.1",
Expand All @@ -83,12 +83,12 @@
{
"ver": "0.4.1",
"date": "2022-06-04",
"txt": "- Fix a _copy bug"
"txt": "- Fixed a _copy bug"
},
{
"ver": "0.4.2",
"date": "2022-06-04",
"txt": "- Fix Items page price filter and expand it\n- (Typos/Tags)"
"txt": "- Fixed Items page price filter and expand it\n- (Typos/Tags)"
},
{
"ver": "0.5.0",
Expand All @@ -98,7 +98,12 @@
{
"ver": "0.5.1",
"date": "2022-06-12",
"txt": "- Fix Text Converter breaking on Feats without any actions attached\n- Start work on Strength of Thousands: Hurricane's Howl\n- (Typos/Tags)"
"txt": "- Fixed Text Converter breaking on Feats without any actions attached\n- Start work on Strength of Thousands: Hurricane's Howl\n- (Typos/Tags)"
},
{
"ver": "0.5.2",
"date": "2022-06-12",
"txt": "- Updated the production and release scripts with the mothersite, including Docker containers\n - Hopefully fixed serviceworker on production"
}
]
}
2 changes: 1 addition & 1 deletion js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if (typeof module !== "undefined") require("./parser.js");

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

Expand Down
Loading

0 comments on commit baa0a03

Please sign in to comment.