image: archlinux
packages:
  - go
  - goreleaser-bin
  - hut
  - weblate-wlc
secrets:
  - 2a17e258-3e99-4093-9527-832c350d9c53
oauth: pages.sr.ht/PAGES:RW
tasks:
  - weblate-update: |
      wlc --format text pull scotty
  - test: |
      cd scotty
      go build -v .
      go test -v ./...
  - build: |
      cd scotty
      GIT_REF=$(git describe --always)
      if [[ "$GIT_REF" =~ ^v[0-9]+\.[0-9]+(\.[0-9]+)?$ ]]
      then
        goreleaser release --clean
      else
        goreleaser release --snapshot --clean
      fi
      cd dist/
      tar cvf artifacts.tar scotty-*.{gz,zip} scotty_*_checksums.txt
  - publish-redirect: |
      # Update redirect on https://go.uploadedlobster.com/scotty
      ./scotty/pages/publish.sh
artifacts:
  - scotty/dist/artifacts.tar