-
Notifications
You must be signed in to change notification settings - Fork 14
107 lines (92 loc) · 3.57 KB
/
create-documentation-pr.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
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: create documentation PR
on:
workflow_dispatch:
inputs:
version_tag:
description: |
The branch or tag name when generaing the QMDs. Also used for the name of the PR.
The name of the current branch or tag is used by default
type: string
push:
tags:
- '*'
jobs:
list:
runs-on: ubuntu-latest
outputs:
component_matrix: ${{ steps.set_matrix.outputs.components }}
workflow_matrix: ${{ steps.set_matrix.outputs.workflows }}
steps:
- uses: actions/checkout@v4
- uses: viash-io/viash-actions/setup@v5
- id: ns_list_components
uses: viash-io/viash-actions/ns-list@v5
with:
platform: docker
format: json
query_namespace: ^(?!workflows)
- id: ns_list_workflows
uses: viash-io/viash-actions/ns-list@v5
with:
format: json
query_namespace: ^workflows
- id: set_matrix
run: |
echo "components=$(jq -c '[ .[] |
{
"name": .functionality.name,
"namespace_separator": .platforms | map(select(.type == "docker"))[0].namespace_separator,
"namespace": .functionality.namespace,
"config": .info.config,
"dir": .info.config | capture("^(?<dir>.*\/)").dir
}
]' ${{ steps.ns_list_components.outputs.output_file }} )" >> $GITHUB_OUTPUT
echo "workflows=$(jq -c '[ .[] |
{
"name": $config.functionality.name,
"namespace": $config.functionality.namespace,
"main_script": ((.info.config | capture("^(?<dir>.*\/)").dir) + "/" + (.functionality.test_resources | map(select(.type == "nextflow_script")) | unique | .[].path )),
"config": .info.config,
"entry": .functionality.test_resources | map(select(.type == "nextflow_script")) | .[].entrypoint
}
]' ${{ steps.ns_list_workflows.outputs.output_file }} )" >> $GITHUB_OUTPUT
push_documentation:
runs-on: ubuntu-latest
needs: [ list ]
steps:
- uses: actions/checkout@v4
with:
path: openpipelines
- uses: actions/checkout@v4
with:
repository: openpipelines-bio/website
path: website
token: ${{ secrets.GTHB_PAT }}
- uses: viash-io/viash-actions/setup@v5
- name: Get tag to use
id: get_tag
run: |
INPUT_TAG="${{ github.event.inputs.version_tag }}"
TAG_OR_BRANCH_NAME=${INPUT_TAG:-"${{ github.ref_name }}"}
echo "tag=$TAG_OR_BRANCH_NAME" >> $GITHUB_OUTPUT
- uses: viash-io/viash-actions/pro/generate-documentation-qmd@v5
with:
project_directory: openpipelines
src: ./
output_dir: ../website/components/
dest_path: "{type}s/{namespace}/{name}.qmd"
viash_pro_token: ${{ secrets.GTHB_PAT }}
tools_version: main_build
ref: "${{ steps.get_tag.outputs.tag }}"
- name: Create Pull Request
env:
GITHUB_TOKEN: ${{ secrets.GTHB_PAT }}
working-directory: website
run: |
git config user.name github-actions
git config user.email [email protected]
git add .
git checkout -B "release-${{ steps.get_tag.outputs.tag }}"
git commit -m "OpenPipelines release ${{ steps.get_tag.outputs.tag }}"
git push --set-upstream origin "release-${{ steps.get_tag.outputs.tag }}"
gh pr create --title "Openpipeline release ${{ steps.get_tag.outputs.tag }}" --base main --head "release-${{ steps.get_tag.outputs.tag }}" --body ""