-
Notifications
You must be signed in to change notification settings - Fork 1
107 lines (89 loc) · 3.07 KB
/
build-and-deploy.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: biocbook
on:
push:
branches:
- devel
- RELEASE_**
jobs:
build-push:
runs-on: ubuntu-latest
name: Build and push Docker [${{ github.ref_name }}]
permissions:
contents: write
packages: write
steps:
- name: 🧾 Checkout repository
uses: actions/checkout@v3
with:
persist-credentials: false
- name: 📝 Get book info
id: info
run: |
echo pkgversion=$(grep -m1 -E '^Version: +' DESCRIPTION | sed -E 's/.*: +//') >> "${GITHUB_ENV}"
- name: 🔐 Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 🏷 Get metadata for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository_owner }}/${{ github.workflow }}
tags: |
type=raw,value=${{ env.pkgversion}},enable=true
type=raw,value=${{ github.ref_name }},enable=true
- name: 👷 Build and push multi-arch Docker image
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64
file: Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
outputs: type=image,annotation-index.org.opencontainers.image.description=${{ github.workflow }}
build-args: |
BIOC_VERSION=${{ github.ref_name }}
render-deploy:
needs: build-push
runs-on: ubuntu-latest
name: Render and publish book [${{ github.ref_name }}]
container: ghcr.io/${{ github.repository_owner }}/${{ github.workflow }}:${{ github.ref_name }}
permissions:
contents: write
packages: read
steps:
- name: 🧾 Checkout repository
uses: actions/checkout@v3
with:
persist-credentials: false
- name: 📦 List installed packages
run: |
pkgs <- installed.packages()[,"Package"]
sessioninfo::session_info(pkgs, include_base = TRUE)
shell: Rscript {0}
- name: 📚 Install rsync
run: |
apt-get update && apt-get install -y rsync
- name: 🔧 Install quarto dependencies
run: |
quarto install tinytex
quarto check
# - name: 🔧 Install python dependencies
# uses: py-actions/py-dependency-install@v4
# with:
# path: "inst/assets/requirements.txt"
- name: 🖌 Render book from versioned container
run: |
quarto render
- name: 🏷 Get gh-branch directory to deploy to
run: |
echo folder=$(echo ${{ github.ref_name }} | sed 's,RELEASE_,,' | tr '_' '.') >> "${GITHUB_ENV}"
- name: 🚀 Deploy book to Github Pages on versioned branch
uses: JamesIves/github-pages-deploy-action@v4.4.3
with:
folder: docs/
target-folder: docs/${{ env.folder }}/
branch: gh-pages
clean: false