Migrate from travisci to github actions

because all my other repos use it and hackernews told me travisci free tier is
dead.
This commit is contained in:
Niklas Fasching 2021-01-02 20:34:11 +01:00
parent cdc54f17b1
commit 1b68e209ac
8 changed files with 76 additions and 46 deletions

29
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,29 @@
name: CI
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: git
run: |
git clone --depth 1 "https://x-access-token:${{secrets.GITHUB_TOKEN}}@github.com/${GITHUB_REPOSITORY}" .
git config user.name "GitHub Action"
git config user.email "action@github.com"
git log -1 --format="%H"
- name: test
run: make test
- name: gh-pages
run: |
git checkout --orphan gh-pages && git reset
make generate-gh-pages
git add -f docs/ && git commit -m deploy
git push -f origin gh-pages
- name: notify
if: ${{ failure() }}
run: |
text="https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID} failed"
curl --silent --output /dev/null ${{secrets.TELEGRAM_URL}} -d "chat_id=${{secrets.TELEGRAM_CHAT_ID}}&text=${text}"

2
.gitignore vendored
View file

@ -1,4 +1,4 @@
/gh-pages/
/docs/
/go-org
/fuzz
/org-fuzz.zip

View file

@ -1,14 +0,0 @@
language: go
go: "1.x"
script:
- make test
- make generate-gh-pages
deploy:
provider: pages
github-token: $GITHUB_TOKEN # From travis-ci.org repository settings
local-dir: gh-pages
target-branch: gh-pages
skip-cleanup: true
verbose: true
on:
branch: master

View file

@ -1,4 +1,4 @@
* go-org [[https://travis-ci.org/niklasfasching/go-org.svg?branch=master]]
* go-org
An Org mode parser and static site generator in go.
Take a look at github pages
- for [[https://niklasfasching.github.io/go-org/][org to html conversion]] examples

View file

@ -124,10 +124,10 @@ convert="<html>
</body>
</html>"
mkdir -p gh-pages
mkdir -p docs
go get github.com/chaseadamsio/goorgeous
cp etc/_goorgeous.go gh-pages/goorgeous.go
go build -o gh-pages/goorgeous gh-pages/goorgeous.go
cp etc/_goorgeous.go docs/goorgeous.go
go build -o docs/goorgeous docs/goorgeous.go
go_org_vs_goorgeous_examples="<html>
<head>
<style>
@ -142,20 +142,20 @@ for org_file in $org_files; do
go_org_vs_goorgeous_examples+="
<h2><a id='${name}' href='#toc-${name}'>${name}</a></h2>
<div class='source'>
<div class='html'>$(./gh-pages/goorgeous $org_file)</div>
<div class='html'>$(./docs/goorgeous $org_file)</div>
<div class='html'>$(./go-org render $org_file html-chroma)</div>
</div>"
done
go_org_vs_goorgeous_examples+="</body></html>"
rm gh-pages/goorgeous gh-pages/goorgeous.go
rm docs/goorgeous docs/goorgeous.go
echo "$index" > gh-pages/index.html
echo "$convert" > gh-pages/convert.html
echo "$go_org_vs_goorgeous_examples" > gh-pages/go-org-vs-goorgeous.html
cp etc/_wasm.go gh-pages/wasm.go
GOOS=js GOARCH=wasm go build -o gh-pages/main.wasm gh-pages/wasm.go
rm gh-pages/wasm.go
cp $(go env GOROOT)/misc/wasm/wasm_exec.js gh-pages/wasm_exec.js
echo "$index" > docs/index.html
echo "$convert" > docs/convert.html
echo "$go_org_vs_goorgeous_examples" > docs/go-org-vs-goorgeous.html
cp etc/_wasm.go docs/wasm.go
GOOS=js GOARCH=wasm go build -o docs/main.wasm docs/wasm.go
rm docs/wasm.go
cp $(go env GOROOT)/misc/wasm/wasm_exec.js docs/wasm_exec.js
mkdir -p gh-pages/blorg
cp -r blorg/testdata/public/* gh-pages/blorg/
mkdir -p docs/blorg
cp -r blorg/testdata/public/* docs/blorg/

View file

@ -203,20 +203,35 @@ Paragraphs can contain inline markup like <em>emphasis</em> <strong>strong</stro
<li>
<p>example block</p>
<pre class="example">
language: go
go: &#34;1.x&#34;
script:
- make test
- make generate-gh-pages
deploy:
provider: pages
github-token: $GITHUB_TOKEN # From travis-ci.org repository settings
local-dir: gh-pages
target-branch: gh-pages
skip-cleanup: true
verbose: true
on:
branch: master
name: CI
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: git
run: |
git clone --depth 1 &#34;https://x-access-token:${{secrets.GITHUB_TOKEN}}@github.com/${GITHUB_REPOSITORY}&#34; .
git config user.name &#34;GitHub Action&#34;
git config user.email &#34;action@github.com&#34;
git log -1 --format=&#34;%H&#34;
- name: test
run: make test
- name: gh-pages
run: |
git checkout --orphan gh-pages &amp;&amp; git reset
make generate-gh-pages
git add -f docs/ &amp;&amp; git commit -m deploy
git push -f origin gh-pages
- name: notify
if: ${{ failure() }}
run: |
text=&#34;https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID} failed&#34;
curl --silent --output /dev/null ${{secrets.TELEGRAM_URL}} -d &#34;chat_id=${{secrets.TELEGRAM_CHAT_ID}}&amp;text=${text}&#34;
</pre>
</li>
</ul>

View file

@ -27,7 +27,7 @@ for now files can be included as:
- export block
#+INCLUDE: "./paragraphs.html" export html
- example block
#+INCLUDE: "../../.travis.yml" example yaml
#+INCLUDE: "../../.github/workflows/ci.yml" example yaml
*** DONE [[https://github.com/chaseadamsio/goorgeous/issues/33][#33]]: Wrong output when mixing html with Org mode
#+HTML: <div class="outline-2" id="meta" style="color: green;">
| *foo* | foo |

View file

@ -27,7 +27,7 @@ for now files can be included as:
- export block
#+INCLUDE: "./paragraphs.html" export html
- example block
#+INCLUDE: "../../.travis.yml" example yaml
#+INCLUDE: "../../.github/workflows/ci.yml" example yaml
*** DONE [[https://github.com/chaseadamsio/goorgeous/issues/33][#33]]: Wrong output when mixing html with Org mode
#+HTML: <div class="outline-2" id="meta" style="color: green;">
| *foo* | foo |