Builds (sourcehut)

Overview

The sourcehut build service is an alternative to GitHub Actions, providing various features that are very useful. Its generally used for continuous integrations or for testing.

Example

The following codeblock contains an example of how a build file could look like. This file is either located in /.build.yml where / is the project's root directory or in /.builds/<some-name>.yml if multiple files are present. This can be seen in the aerc repository.

image: alpine/edge
oauth: pages.sr.ht/PAGES:RW

sources:
- git@git.sr.ht:~example/example-website

packages:
  - nodejs
  - npm
  - hut

environment:
  site: example.com

tasks:
  - install-deps: |
     cd example-website
     npm install

  - build: |
      cd example-website
      npx @11ty/eleventy
      npm run setup-search

  - package: |
      cd example-website
      cd _site
      tar -czf ../site.tar.gz .

  - upload: |
      cd example-website
      hut pages publish -d "$site" site.tar.gz

If a test environment is wanted, it is also possible to just start up a virtual machine with an interactive shell. This shell can be connected to via ssh.

image: openbsd/latest
shell: true