NotRanged / NotRanged.github.io

Web frontend for FFXIV Crafting Optimizer service.
zlib License
73 stars 43 forks source link

Create Github Action to deploy the site #82

Open Orphis opened 1 year ago

Orphis commented 1 year ago

This adds a Github Action that automatically builds and deploy the website from the master branch when it is updated.

dazemc commented 1 year ago

The site is not built from the master branch. It is built from the gh-pages branch and already has this functionality

dazemc commented 1 year ago

I also have a fork that updates automatically, daily.

Orphis commented 1 year ago

Why wouldn't it be built from the master branch? The gh-pages is just an export from the master branch, that part should be automated, which is what this is doing.

Orphis commented 1 year ago

Let me clarify this: you don't have to do any manual changes to change the gh-pages branch with automation, you just update master and it's published moments later (not daily or whatnot). This requires a change in the project settings to deploy from a Github action instead of a branch, but this is the better and newer intended way from Github to publish any project with build steps.

I noticed people had issues with this in comments like this one: https://github.com/NotRanged/NotRanged.github.io/pull/77#issuecomment-1640575636

dazemc commented 1 year ago

I updated the recipe, food, medicine script to pull all the data from xivapi. In the past, it would take days to weeks to update the data. This addresses #77 by fully automating the process. It could be made more efficient by using a different trigger than cron everyday but it was easy to implement. As to why the gh-pages is a separate branch I can only guess but this is not my repo so that is why I forked it to make the same functionality as you described above using Jekyll rather than node.

Orphis commented 1 year ago

I checked your repository and it will create a change every day even if the data has not changed. Also, the data fetched with the script is unstable and could change between runs. I sent a PR #83 to fix those issues.

I don't think that automatically updating the data is the right call without checks to ensure the data is sane (we don't have an interrupted job, some transient errors from xivapi or something) for all files. But creating a PR automatically which could be merged would be the right call for now.

Then this action would automatically update the deployed website after the files have been updated.

dazemc commented 1 year ago

I agree that it should not be called every day and it's one of the main reasons I haven't pushed it into this repo. Also if xivapi were to be down during that time' then I'm pretty sure it would just wipe out the data. Sorting by ID makes sense and I merged #83. As for checks, could we compare IDs from old data to new data and then create an automatic PR based off of that?

Will merging this action need any adjustments to this repos settings? I don't have access to change the deployment/actions settings.

Orphis commented 1 year ago

It will probably be ok to check every day, or whenever the action is triggered manually.

I don't think this requires a change of deployment/actions but will probably require a change to the Pages settings to go from "deploy from a branch" to "deploy from an action".

If people do not have access to the repository, it might be better to create an organization with a fork and a new repository that many people maintain as it'll be better longer term and redirect people to that deployment.