Skip to content

Commit cc79343

Browse files
committed
Build documentation using nix for CI
1 parent 8d3de40 commit cc79343

File tree

1 file changed

+54
-37
lines changed

1 file changed

+54
-37
lines changed
Lines changed: 54 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,63 @@
1-
name: Build and Deploy
1+
name: Build and Deploy static content to GitHub Pages
22

33
on:
4-
workflow_dispatch:
54
push:
6-
branches: [ "master" ]
5+
branches: master
76
pull_request:
8-
branches: [ "master" ]
7+
branches: master
8+
9+
# Allows you to run this workflow manually from the Actions tab
10+
workflow_dispatch:
911

1012
permissions:
1113
contents: read
14+
pages: write
15+
id-token: write
16+
17+
# Allow one concurrent deployment
18+
concurrency:
19+
group: "pages"
20+
cancel-in-progress: true
1221

1322
jobs:
14-
build_and_deploy:
15-
runs-on: ubuntu-latest
16-
steps:
17-
- uses: actions/checkout@v3
18-
- name: Install dependencies
19-
run: |
20-
sudo apt-get update;
21-
sudo apt-get install --yes \
22-
texinfo groff \
23-
texlive-base texlive-fonts-recommended texlive-plain-generic
24-
- name: Set up Ruby
25-
uses: ruby/setup-ruby@v1
26-
with:
27-
ruby-version: 2.7
28-
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
29-
- name: Build website
30-
run: bundle exec middleman build
31-
- name: Build documentation
32-
run: make docs
33-
- name: Deploy
34-
if: ${{ github.ref == 'refs/heads/master' }}
35-
env:
36-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
37-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
38-
uses: reggionick/s3-deploy@v3
39-
with:
40-
folder: build
41-
bucket: ${{ vars.AWS_S3_BUCKET }}
42-
bucket-region: ${{ vars.AWS_S3_BUCKET_REGION }}
43-
delete-removed: true
44-
no-cache: true
45-
private: true
46-
filesToInclude: ".*/*,*/*,**"
23+
build:
24+
environment:
25+
name: github-pages
26+
url: ${{ steps.deployment.outputs.page_url }}
27+
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v3
31+
- name: Set up Ruby
32+
uses: ruby/setup-ruby@v1
33+
with:
34+
ruby-version: 2.7
35+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
36+
- name: Build website
37+
run: bundle exec middleman build
38+
39+
- uses: cachix/install-nix-action@v20
40+
with:
41+
nix_path: nixpkgs=channel:nixos-unstable
42+
- name: Build documentation
43+
env:
44+
OWNER: afh
45+
REPO: ledger
46+
run: |
47+
# TODO: change ledger to ${OWNER} prior to merging
48+
LATEST=$(curl -sqI -w '%{redirect_url}' -o /dev/null https://github.com/ledger/${REPO}/releases/latest | awk -F/ '{print $NF}')
49+
# TODO: remove this override prior to merging
50+
LATEST=web-docs
51+
nix build github:${OWNER}/${REPO}/${LATEST}#web-docs
52+
mkdir -p build/doc
53+
cp result/share/doc/ledger/ledger* build/doc
54+
55+
- name: Setup Pages
56+
uses: actions/configure-pages@v3
57+
- name: Upload artifact
58+
uses: actions/upload-pages-artifact@v1
59+
with:
60+
path: 'build'
61+
- name: Deploy to GitHub Pages
62+
id: deployment
63+
uses: actions/deploy-pages@v1

0 commit comments

Comments
 (0)