💾 Archived View for srht.site › automating-deployments.gmi captured on 2023-11-14 at 07:26:50. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2022-03-01)
➡️ Next capture (2024-03-21)
-=-=-=-=-=-=-
It’s not a good idea to repeat the quick start process every time you want to update your capsule. So let’s automate it!
First, create a repository on git.sr.ht or hg.sr.ht named after your capsule (e.g. “your-username.srht.site”), and push your capsule’s source code to it.
Unfamiliar with git or hg? Check out the tutorial.
We’ll be using builds.sr.ht to automate building and deploying our capsule. Create a file named “.build.yml” and fill it in with this template:
image: alpine/latest oauth: pages.sr.ht/PAGES:RW environment: site: your-username.srht.site tasks: - package: | cd $site tar -cvz . > ../site.tar.gz - upload: | acurl -f https://pages.sr.ht/publish/$site \ -Fcontent=@site.tar.gz \ -Fprotocol=GEMINI
"acurl" is short for "authenticated curl", it's a curl wrapper available in our build environment that is automatically authenticated to sr.ht APIs using an OAuth token generated on-the-fly with the permissions requested by the "oauth" directive - in this case, only enough to deploy your capsule.
Update the site variable to your desired domain (e.g. “your-username.srht.site”). You can also add additional steps under tasks and package to call a static capsule generator and bundle your capsule differently. Once you’re done, commit this file to your repository and push. A URL will be printed to your console which you can click on to follow the progress on deploying your capsule. Once it’s done, that’s it - your capsule will be re-published every time you push.
For more information about using builds.sr.ht, consult the builds.sr.ht documentation: