-
Notifications
You must be signed in to change notification settings - Fork 15
136 lines (116 loc) · 5.13 KB
/
Copy pathpublish.yml
File metadata and controls
136 lines (116 loc) · 5.13 KB
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# This action runs when a release is created via tagging or via GitHub UI.
#
# Workflow steps:
# - checkout gh-pages for updating
# - create joined vocabulary file in addition to split version
# - create excel-file from turtle
# - build docs
# - publish docs, vocabulary-turtle files and excel-file to gh-pages
name: Publish
on:
push:
tags:
- 'v[0-9]+-[0-9]+-[0-9]+'
release:
types: [published]
env:
PIP_DISABLE_PIP_VERSION_CHECK: "1"
PIP_PROGRESS_BAR: "off"
LOGLEVEL: "DEBUG"
VOC4CAT_VERSION: ${{github.ref_name}} # use release tag as version
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions: {}
jobs:
build:
name: Release vocabulary & documentation
permissions:
contents: write # Required for peaceiris/actions-gh-pages below
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
with:
# Using fetch-depth 0 is the only way to get all tags which are needed for building docs.
fetch-depth: 0
# Be specific about keeping credentials (it is the default)
persist-credentials: true
- name: Checkout gh-pages branch to dir publish/
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
with:
ref: gh-pages
path: publish
fetch-depth: 1
# Be specific about keeping credentials (it is the default)
persist-credentials: true
- uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548
with:
python-version: '3.13'
- name: Install dependencies
run: |
python -VV
python -m pip install --upgrade pip setuptools wheel
# Select to install a stable tagged version or main branch (in development)
python -m pip install git+https://github.com/nfdi4cat/voc4cat-tool.git@v1.0.0
# python -m pip install git+https://github.com/nfdi4cat/voc4cat-tool.git@main
# install custom pylode 2.x
python -m pip install git+https://github.com/dalito/pyLODE.git@nfdi4cat-2.x
- name: Set dynamic environment variables.
run: |
echo "VOC4CAT_MODIFIED=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Run voc4cat (publish joined & split SKOS/turtle)
run: |
voc4cat --version
mkdir -p publish/latest/
# delete files xlsx, xml and ttl produced in previous workflow runs
find publish/latest/ -type f \( -name "*.xlsx" -o -name "*.ttl" -o -name "*.xml" \) -delete
cp -r vocabularies/. publish/latest/
# Build joined turtle
voc4cat transform --join --config idranges.toml --logfile publish/latest/voc4cat.log publish/latest/
- name: Run voc4cat (build pyLODE HTML documentation)
run: |
voc4cat docs --force --logfile publish/latest/voc4cat.log publish/latest/
# move versions-overview to what becomes gh-pages root
mv publish/latest/index.html publish/
- name: Run voc4cat (build current Excel file)
# Passing the config is important to make use of the prefixes therein.
run: |
# Using a template is optional and gives just a warning if missing.
voc4cat convert --config idranges.toml --logfile publish/latest/voc4cat.log --template templates/default_sheets.xlsx publish/latest/
- name: Run voc4cat (build vocabulary in xml/rdf from Excel file)
# Passing the config is important to make use of the prefixes therein.
run: |
voc4cat convert --config idranges.toml --logfile publish/latest/voc4cat.log --outputformat xml publish/latest/voc4cat.xlsx
- name: Copy release to release-name directory
run: |
mkdir -p publish/${GITHUB_REF_NAME}
cp -r publish/latest/. publish/${GITHUB_REF_NAME}/
- name: Build Sphinx documentation (website)
run: |
python -VV
python -m pip install -r docs/requirements.txt --force
sphinx-build --nitpicky --fail-on-warning --keep-going docs docs/_build
cp -r docs/_build/. publish/
- name: Deploy updated gh-pages content
# This replaces all prior content in gh-pages branch. But we have
# checked out the gh-pages branch above so that we keep all prior
# content and just re-publish the extended version.
# Pinning of action managed by dependabot
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./publish
force_orphan: true
- name: Store publish dir (=pages) as artifact
# This step is not required and may be removed.
# It may be helpful for troubleshooting.
if: ${{ always() }}
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4
with:
name: voc4cat-pages-release-${{ github.ref_name }}
path: publish/
retention-days: 5
# Lit:
# https://github.com/peaceiris/actions-gh-pages