generated from srid/ema-template
-
Notifications
You must be signed in to change notification settings - Fork 72
90 lines (88 loc) · 2.68 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: "CI"
on:
# Run only when pushing to master branch
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: nixbuild/nix-quick-install-action@v21
with:
nix_conf: |
experimental-features = nix-command flakes
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- uses: cachix/cachix-action@v11
with:
name: srid
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- name: Build Nix
id: build-nix
run: |
nix run github:srid/nixci
nix path-info -rSh .#default | sort -rhk2 | head
- name: Build as docker img
id: build
run: |
nix build -j auto -o docker-img .#dockerImage
# docker
export DOCKERIMG=$(readlink ./docker-img)
echo "::set-output name=docker-img::${DOCKERIMG}"
- name: Upload docker image tgz
uses: actions/upload-artifact@v2
if: github.ref == 'refs/heads/master'
with:
name: docker-img
retention-days: 1
path: |
${{ steps.build.outputs.docker-img }}
docker:
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
env:
DOCKERTAG: latest
steps:
- name: Download docker img
uses: actions/download-artifact@v2
with:
name: docker-img
- name: Load Docker img
run: |
docker load -i *docker-image-emanote.tar.gz
- name: Publish Docker image to Docker Hub
run: |
echo ${{ secrets.DOCKER_PASS }} | docker login -u sridca --password-stdin
set -x
docker push sridca/emanote:latest
website:
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- name: Download docker image
uses: actions/download-artifact@v2
with:
name: docker-img
- name: Load Docker image
run: |
docker load -i *docker-image-emanote.tar.gz
- name: Generate website HTML 🔧
run: |
mkdir -p ./docs/.ci/output
# demo.md has broken links for demo
docker run \
-e LANG=C.UTF-8 -e LC_ALL=C.UTF-8 \
-v $PWD/docs:/data \
--tmpfs /tmp \
sridca/emanote emanote --layers /data --allow-broken-links gen /data/.ci/output
cp -r ./docs/.ci .
- name: Deploy to website to gh-pages 🚀
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: .ci/output
cname: emanote.srid.ca