~sircmpwn/pages.sr.ht-examples

6979815a6a391484e08e488b20efb3ab1f67e5f6 — Drew DeVault 2 months ago d1bb90a master
Add Go vanity import example
1 files changed, 54 insertions(+), 0 deletions(-)

A go-vanity.yml
A go-vanity.yml => go-vanity.yml +54 -0
@@ 0,0 1,54 @@
image: alpine/latest
packages:
  - go
oauth: pages.sr.ht/PAGES:RW
environment:
  # The domain to deploy to
  site: example.org
  # The clone URL for your repository
  repository: https://git.sr.ht/~username/example
  # The version control system in use
  vcs: git
  # The prefix to use, e.g. "foo" produces go.example.org/foo
  #
  # You can remove this to use the root directory (e.g. go.example.org) by
  # deleting the "prefix" from vangen.json below.
  prefix: example
tasks:
- vangen: |
    # Add subpackage names to "subs" below.
    #
    # For instance, if you have a subpackage called bar, and prefix set to
    # "foo", you can add "go.example.org/foo/bar" by adding "bar" to subs.
    #
    # The "source" URLs below are pre-configured for repositories hosted on
    # git.sr.ht, but you should change or remove these if your repositories are
    # hosted elsewhere. For hg.sr.ht, just replace git with hg in the URLs.
    #
    # See https://github.com/leighmcculloch/vangen for details.
    cat <<EOF >vangen.json
    {
      "domain": "$site",
      "repositories": [
        {
          "prefix": "$prefix",
          "subs": [
          ],
          "type": "$vcs",
          "url": "$repository",
          "source": {
            "home": "$repository",
            "dir": "$repository/tree/master{/dir}",
            "file": "$repository/tree/master{/dir}/{file}#L{line}"
          }
        }
      ]
    }
    EOF
    export GOPATH=$HOME/go
    go get 4d63.com/vangen
    ./go/bin/vangen
- package: |
    tar -C vangen -cvz . > site.tar.gz
- upload: |
    acurl -f https://pages.sr.ht/publish/$site -Fcontent=@site.tar.gz