Blade's Informal Blog

Get silly !!!!


Deploying to Neocities via GitHub Actions

Wanted to write up a small tutorial for anyone not using node. Based on this tutorial, but for people not using NodeJS to make their site.

You need to do 3 main things:

Making a Folder for your Website Stuff

I assume you have somewhere you've been writing your site if you want to deploy from GitHub, so go there. I made this one using VSCode, so I'll explain how to do it in there. Make a folder, title it whatever you want (mine is called 'dist_dir'), and then put everything related to your site in that folder. This will be everything that gets pushed to Neocities.

We do this because we don't want all the git stuff getting pushed to Neocities. We just want our website stuff!

Getting an API Token

Go to your neocities account, Account Settings > Manage Site Settings > API > Generate API Key. Copy this and DO NOT PUT IT ANYWHERE IN YOUR CODE. ONLY YOU SHOULD HAVE THIS. DON'T PUSH IT TO YOUR REPO!!

Go to your GitHub repo > Settings > Secrets And Variables > Actions. Make a new secret, name it 'NEOCITIES_API_TOKEN' and paste your secret in the box below. Save it.

Making A deploy.yml File

Okay, so for this one, go back to your favorite code editor. Make a folder called '.github', then in that folder, make another folder called 'workflows'. In the workflows folder, made a file called 'deploy.yml'. It doesn't have to be called deploy.yml, it can be anything.yml, but I called mine deploy.yml. The example file in the linked tutorial uses NodeJS, so we're going to use an edited version I made. Here is my deploy.yml. The only thing you have to do is change the "dist_dir:" line (the one at the end) to the name of your website stuff folder. Mine is just 'dist_dir' again, but if yours is called 'mystuff', then the last line would look like "dist_dir: mystuff"!

Push Your Changes to GitHub

Alright, now push all of your changes to GitHub and it should start building! If you go to your GitHub repo > Actions > Deploy to neocities (on the left side of the screen), you should see it building (yellow) or built (green). If you go to your neocities url, you should see your site appear there.

Your website will rebuild every time you push to that repo, so, now you don't have to do anything to update your neocities site other than push your code :D if you have any questions, you can message me on Discord. My username is blade.py

Icon of Pikachu and Togepi. Pikachu is on a boat and Togepi is attached to a rope as they both float down a river.

RESOURCES:

EASY VIEW:

Make It Plain
I Hate Red
I Use Linux

The tbh creature. It is a small white creature with big eyes and 4 legs, meant to be lighthearted and kind of cute. Often used in online memes with a 'YIPPEE!' sound effect.