~toastal/sourcehut-asciidoc-renderer

411da755bed3c99ce8fc32d26db6ff921d5bd0c8 — toastal 11 months ago 3d6a2b9
modernize .build.yml
1 files changed, 7 insertions(+), 21 deletions(-)

M .build.yml
M .build.yml => .build.yml +7 -21
@@ 1,17 1,15 @@
image: nixos/unstable
oauth: git.sr.ht/PROFILE:RO git.sr.ht/REPOSITORIES:RW
packages:
  - nixos.cachix
  - nixos.curl
  - nixos.hut
  - nixos.jq
  - nixos.nixUnstable
  - nixos.tree
environment:
  repo_id: "114457"
  repo_name: "sourcehut-asciidoc-renderer"
  cachix_cache: "toastal"
secrets:
  - 70d21287-b00c-4c11-8442-7458da548ee9 # auth
  - dfe65467-208b-41e7-bf6c-cec8e2985211 # cachix
  - d44053aa-7f58-49fc-9bb9-ed6930cd7f68 # cachix
tasks:
  - prepare: |
      # Enable flakes.


@@ 33,19 31,7 @@ tasks:
        | cachix push $cachix_cache
  - readme: |
      cd "$repo_name"
      nix build ".#${repo_name}-readme"  --out-link result-readme --json \
        | jq -r '.[].outputs | to_entries[].value' \
        | cachix push $cachix_cache
      set +x
      jq -sR '{
        "query": "mutation UpdateRepo($id: Int!, $readme: String!) {
          updateRepository(id: $id, input: { readme: $readme }) { id }
        }", "variables": {
          "id": '$repo_id',
          "readme": .
        } }' < "$(realpath result-readme)/share/doc/README.html" \
        | curl \
          --compressed --fail-with-body \
          --oauth2-bearer "$(<$HOME/.${repo_name}-auth-token)" \
          -H "Content-Type: application/json" \
          -d@- "https://git.sr.ht/query"
      nix --accept-flake-config build ".#${repo_name}-readme" --json --out-link "result-readme" \
         | jq -r '.[].outputs | to_entries[].value' \
         | cachix push $cachix_cache
      hut git update $repo_id --readme "$(realpath result-readme)/share/doc/README.html"