guixrus: ci: Add .build.yml with lint and publish tasks v2 APPLIED

Dhruvin Gandhi: 1
 ci: Add .build.yml with lint and publish tasks

 1 files changed, 27 insertions(+), 0 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~whereiseveryone/guixrus/patches/28157/mbox | git am -3
Learn more about email & git

[PATCH guixrus v2] ci: Add .build.yml with lint and publish tasks Export this patch

This only adds a lint task, as indentation is yet to be finalized. It
will not fail build if there are lint errors. This is to allow gradual
move to stricter and appropriate checks.

The lint task uses an undocumented mechanism of builds.sr.ht to stop
the build and call it successful once lint task is passed. This will
make sure the website is not published for arbitrary contributed patches
and is only published for commits pushed/manual job submission.
 .build.yml | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 .build.yml

diff --git a/.build.yml b/.build.yml
new file mode 100644
index 0000000..b2c00fa
--- /dev/null
+++ b/.build.yml
@@ -0,0 +1,27 @@
image: guix
oauth: builds.sr.ht/JOBS:RW builds.sr.ht/PROFILE:RO
- https://git.sr.ht/~whereiseveryone/guixrus
- jq
- lint: |
    cd guixrus
    guix lint -L . -n || true
    if [ "$BUILD_REASON" == patchset ]; then
      complete-build # UNDOCUMENTED builds.sr.ht escape hatch
- publish: |
    curl -s https://git.sr.ht/~whereiseveryone/website/blob/master/.build.yml \
      | jq -sRc --arg jobId "$JOB_ID" --arg jobUrl "$JOB_URL" \
             "query": "mutation Publish($manifest: String!, $note: String!) { submit(manifest: $manifest, note: $note) { id owner { canonicalName } } }",
             "variables": {
               "manifest": "\(.)",
               "note": "Publish [~whereiseveryone/website](https://git.sr.ht/~whereiseveryone/website) for build [#\($jobId)](\($jobUrl))"
          }' \
      | acurl -s -X POST https://builds.sr.ht/query \
          -H 'Content-Type: application/json' \
          -d @- \
      | jq -r '"Publishing: https://builds.sr.ht/\(.data.submit.owner.canonicalName)/job/\(.data.submit.id)"'