arch: null artifacts: [] environment: BUILD_SUBMITTER: git.sr.ht GIT_REF: refs/heads/trunk image: freebsd/latest packages: - gmake - pkgconf - fusefs-libs3 - rust repositories: {} secrets: - e1ab5b37-2c65-4a1a-95d6-baa2e4ecdda9 - ef46bf77-4a88-4162-af3a-3f53cf4388ab shell: false sources: - https://git.sr.ht/~nabijaczleweli/febug#ac31831994ef52074600093b8ff0cdde361aecde tasks: - ghostscript: | sudo pkg install -y $(pkg search ghostscript | grep -o 'ghostscript[[:digit:]]*' | sort -n | tail -n1) - build: | cd febug gmake - rust: | cd febug gmake rust-build - push-manpages: | git -C febug/ worktree add ../febug-man man cd febug-man rm -rf FreeBSD mv ../febug/out/man FreeBSD sed -e 's/…/.../g' -e 's/\t/ /g' $(find FreeBSD/ -type f -name '*.[123456789]' | awk -F. '{OFS=FS; last=$NF; --NF; print last "\t" $0}' | sort | awk -F'\t' '{print $2 "." $1}') | mandoc -mdoc -Tps -O paper=a4 > FreeBSD.ps ps2pdf FreeBSD.ps FreeBSD.pdf git add . git config user.email "nabijaczleweli/autouploader@nabijaczleweli.xyz" git config user.name "наб autouploader" git commit -m "FreeBSD manpage update by job $JOB_ID" || exit 0 git remote set-url origin 'git@git.sr.ht:~nabijaczleweli/febug' ssh-keyscan git.sr.ht > ~/.ssh/known_hosts while true; do git push && break for _ in $(seq 0 10); do sleep 5 git fetch git rebase git push && break 2 done echo "Couldn't push manpages!" exit 1 done - upload-release: | set -o posix # bash in non-POSIX mode doesn't process aliases non-interactively. good shell. tag="$(git -C febug describe --abbrev=0 --tags || echo HEAD~1)" [ "$(git -C febug rev-list -n1 "$tag")" = "$(git -C febug rev-list -n1 HEAD)" ] || exit 0 mv febug-man/FreeBSD "febug-$tag-man-FreeBSD$(uname -r)" mv febug-man/FreeBSD.ps "febug-$tag-man-FreeBSD$(uname -r).ps" mv febug-man/FreeBSD.pdf "febug-$tag-man-FreeBSD$(uname -r).pdf" tar -cvaf "febug-$tag-man-FreeBSD$(uname -r).tbz2" "febug-$tag-man-FreeBSD$(uname -r)" sha256 *.tbz2 set +x # Avoid echoing the token alias curl="curl --oauth2-bearer $(cat ~/.release-token)" id="$(curl -F operations='{"query": "{me {repository(name: \"febug\") {id}}}"}' -F map='{}' https://git.sr.ht/query | tr -cd 0-9)" for f in *.tbz2 "febug-$tag-man-FreeBSD$(uname -r)".{ps,pdf}; do curl -F operations='{ "query": "mutation($id: Int!, $rev: String!, $file: Upload!) {uploadArtifact(repoId: $id, revspec: $rev, file: $file) { created, filename, checksum } }", "variables": { "file": null, "rev": "'"$(git -C febug rev-list -n1 "$tag")"'", "id": '"$id"' } }' \ -F map='{ "a": ["variables.file"] }' \ -F a=@"$f" \ https://git.sr.ht/query echo done triggers: [] oauth: ""