💾 Archived View for adnano.co › 2020 › 05 › 27 › sourcehut-netlify captured on 2023-04-19 at 22:27:56. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2022-03-01)
-=-=-=-=-=-=-
Posted on 2020-05-27
Sourcehut is a great development tool. Unfortunately, Sourcehut does not yet provide static website hosting. Until they do, the second-best option for static website hosting is Netlify.
Update (2021-02-21): Sourcehut now provides static website hosting.
Netlify only offers easy integration with GitHub, GitLab, and Bitbucket. However, we can leverage Sourcehut's builds service to automatically build and publish our website on Netlify.
Go to your Netlify settings by clicking on your profile photo. Press Applications and create a new personal access token.
Go to Sourcehut builds. Press Manage Secrets, then add a new secret. Paste in your Netlify access token. Choose the File secret type, then choose "~/.netlify_token" as the file path.
This build manifest builds the site with Hugo.
# .build.yml image: alpine/edge packages: - curl - hugo - zip secrets: # The id of your Netlify token build secret - netlify-token-secret-id sources: # The repository of your site - https://git.sr.ht/~user/site tasks: # Build the site # Put instructions for building your site here - build: | cd site hugo # Zip up the site before uploading - zip: | zip -r website.zip site/public # Upload the site zip with the Netlify API # Make sure to replace site.netlify.com with your site subdomain - upload: | curl -f \ -H "Content-Type: application/zip" \ -H "Authorization: Bearer $(cat .netlify_token)" \ --data-binary "@website.zip" \ https://api.netlify.com/api/v1/sites/site.netlify.com/deploys
Push your changes and your site should start building automatically.
---
This work is licensed under a CC-BY-SA-4.0 license.