From 4aa3c74a9a68bf6dc97af26799cc54f3862dea86 Mon Sep 17 00:00:00 2001 From: "Stephen M. Coakley" Date: Sat, 6 Jul 2019 21:24:02 -0500 Subject: [PATCH] Update actions workflow --- .github/main.workflow | 24 +++++++++++++++--------- Makefile | 6 +----- riptide/src/init.rip | 8 ++++++++ scripts/publish-docs.sh | 18 ------------------ 4 files changed, 24 insertions(+), 32 deletions(-) delete mode 100755 scripts/publish-docs.sh diff --git a/.github/main.workflow b/.github/main.workflow index e1ed492..8b542a1 100644 --- a/.github/main.workflow +++ b/.github/main.workflow @@ -1,22 +1,28 @@ -workflow "Main" { +workflow "build" { on = "push" - resolves = ["Publish docs"] + resolves = ["test", "publish-docs"] } -action "Test" { +action "test" { uses = "docker://rust" args = "cargo test" } -action "Master" { +action "master-branch" { uses = "actions/bin/filter@b2bea0749eed6beb495a8fa194c071847af60ea1" - needs = ["Test"] args = "branch master" } -action "Publish docs" { +action "docs" { uses = "docker://asciidoctor/docker-asciidoctor" - needs = ["Master"] - args = ["sh", "-c", "apk --no-cache add git && make publish-docs"] - secrets = ["GH_PAT", "GITHUB_TOKEN"] + args = "make docs" +} + +action "publish-docs" { + uses = "maxheld83/ghpages@v0.2.1" + needs = ["master-branch", "docs"] + env = { + BUILD_DIR = "target/docs/" + } + secrets = ["GH_PAT"] } diff --git a/Makefile b/Makefile index 0c09be3..35d2809 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,6 @@ -.PHONY: docs publish-docs - +.PHONY: docs docs: $(patsubst docs/%.adoc,target/docs/%.html,$(wildcard docs/*.adoc)) -publish-docs: docs - scripts/publish-docs.sh - target/docs/%.html: docs/%.adoc @mkdir -p target/docs asciidoctor -b html -o $@ $^ diff --git a/riptide/src/init.rip b/riptide/src/init.rip index cd9f400..0ba88ef 100644 --- a/riptide/src/init.rip +++ b/riptide/src/init.rip @@ -20,3 +20,11 @@ table-set $GLOBALS eq $lang->eq table-set $GLOBALS eval { call $source $string } + +def require-x { + send $GLOBALS->modules->loaders | map { + call $0 $module + } | filter { + nil? $0 + } | head +} diff --git a/scripts/publish-docs.sh b/scripts/publish-docs.sh deleted file mode 100755 index 2c7c6a6..0000000 --- a/scripts/publish-docs.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -set -eu - -COMMIT_HASH=$(git rev-parse HEAD) -COMMIT_MESSAGE="Deploy $COMMIT_HASH" -ORIGIN="https://${GH_PAT}@github.com/${GITHUB_REPOSITORY}.git" - -rm -rf target/docs/.git -touch target/docs/.nojekyll - -git -C target/docs init . -git -C target/docs config user.name "${GITHUB_ACTOR}" -git -C target/docs config user.email "${GITHUB_ACTOR}@users.noreply.github.com" -git -C target/docs add . -git -C target/docs commit -m "${COMMIT_MESSAGE}" -git -C target/docs push "${ORIGIN}" master:gh-pages --force - -rm -rf target/docs/.git