-
Notifications
You must be signed in to change notification settings - Fork 1
79 lines (70 loc) · 3.05 KB
/
update_version_manifest.yml
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
---
# This workflow updates the version manifest (version_manifest.json) of the
# project releases using the branch name, i.e. the project version (e.g. v2.0.0)
# and each JSON schema version.
# The logic of this workflow is:
# - Details: EE-2687
# - Why: It automatically compiles the version of the project and the version
# of the schemas, enabling a structured and traceable documentation.
# - Would block the PR if failed? Yes, as long as the PR is for a release.
# - How: executing script .github/scripts/update_version_manifest.py,
# automatically when opening a PR to "main".
#
# For more information, check:
# https://github.com/EbiEga/ega-metadata-schema/tree/main/docs/releases
name: |
[REQUIRED] Version manifest update (update_version_manifest.yml)
on:
# Executes when opening a PR to the "main" branch
pull_request:
types: [opened]
branches:
- main
jobs:
update-version-manifest:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
# This bit is needed to checkout in the branch that triggered the action
# (e.g. v2.0.1)
ref: ${{ github.head_ref }}
- uses: actions/setup-python@v4
with:
# We'll use the latest version of python from major 3 release
# This bit is needed for running the following python script
python-version: '3.x'
- name: Cache pip
uses: actions/cache@v4
with:
# On subsequent runs, if the cache key matches (i.e., operating system and the hash of the requirements.txt file),
# the dependencies are restored from the cache instead of being downloaded and installed again.
path: ~/.cache/pip
# combines the OS type and a hash of the requirements.txt file: the cache is specific to the dependencies listed
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
# If there is no cache for this key, we create it at the end of the run, even if there was an error mid-way
save-always: true
- name: Install dependencies
run: |
pip install --upgrade pip
requirements_f="./.github/scripts/requirements.txt"
if [ -f "$requirements_f" ]; then pip install -r "$requirements_f" --prefer-binary --verbose; fi
- name: Update version manifest
run: |
script_path="./.github/scripts/update_version_manifest.py"
schemas_path="./schemas"
releases_path="./docs/releases"
python3 "$script_path" --schemas_dir "$schemas_path" --version_manifest_dir "$releases_path"
- name: Setup git config
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Actions Bot"
- name: Commit version manifest changes
run: |
today=$(date +%F)
git add ./docs/releases/version_manifest.json
git commit -m "Update version manifest - $today"
git push