-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
98 lines (86 loc) · 4.1 KB
/
action.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
name: annonars-clinvar-minimal-import
description: Run "annonars clinvar-minimal import"
inputs:
publish-artifacts:
default: "false"
description: "Whether to publish artifacts to the named release"
release-name:
description: "The name of the release to publish artifacts to"
token:
description: 'A Github PAT'
required: true
runs:
using: "composite"
steps:
- name: setup git config
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<>"
# cf. https://github.com/mamba-org/provision-with-micromamba#important
shell: bash -l {0}
- name: Get ClinVar version
id: get-clinvar
run: echo "clinvar-release=$(cat release-name.txt)" >> $GITHUB_OUTPUT
# cf. https://github.com/mamba-org/provision-with-micromamba#important
shell: bash -l {0}
- name: Check cache annonars-clinvar-minimal-import output
id: check-cache-annonars-clinvar-minimal-import-output
uses: actions/cache@v3
with:
path: ${{ env.OUTPUT_DIR }}/${{ matrix.genome_release }}/seqvar/annonars-clinvar-minimal-import
key: annonars-clinvar-minimal-import-${{ env.CACHE_SEED }}-${{ steps.get-clinvar.outputs.clinvar-release }}-${{ env.MAX_RCVS }}-${{ matrix.genome_release }}
lookup-only: true
- name: Cache annonars import output
# Enable this if cache was not hit (we need to rebuild) or we publish and
# then need the cache in any case.
if: |
(steps.check-cache-annonars-clinvar-minimal-import-output.outputs.cache-hit != 'true') ||
(inputs.publish-artifacts == 'true')
uses: actions/cache@v3
with:
path: ${{ env.OUTPUT_DIR }}/${{ matrix.genome_release }}/seqvar/annonars-clinvar-minimal-import
key: annonars-clinvar-minimal-import-${{ env.CACHE_SEED }}-${{ steps.get-clinvar.outputs.clinvar-release }}-${{ env.MAX_RCVS }}-${{ matrix.genome_release }}
- name: Retrieve download-clinvar output
if: steps.check-cache-annonars-clinvar-genes-import-output.outputs.cache-hit != 'true'
uses: actions/cache@v3
with:
path: ${{ env.CLINVAR_JSONL_DIR }}
key: download-clinvar-${{ env.CACHE_SEED }}-${{ steps.get-clinvar.outputs.clinvar-release }}
fail-on-cache-miss: true
- name: Run the annonars import
if: steps.check-cache-annonars-clinvar-minimal-import-output.outputs.cache-hit != 'true'
run: bash .github/actions/clinvar-minimal-import/run.sh
env:
GENOME_RELEASE: "${{ matrix.genome_release }}"
CLINVAR_RELEASE: "${{ steps.get-clinvar.outputs.clinvar-release }}"
# cf. https://github.com/mamba-org/provision-with-micromamba#important
shell: bash -l {0}
- name: Publish artifacts
if: inputs.publish-artifacts == 'true'
run: |
set -xv
genome_release=$(echo ${{ matrix.genome_release }} | tr '[:upper:]' '[:lower:]')
version=$(\
grep ^dc.identifier \
$OUTPUT_DIR/$genome_release/clinvar-minimal/spec.yaml \
| rev \
| cut -d - -f 1 \
| rev)
mkdir -p /tmp/for-upload/annonars-clinvar-minimal-$genome_release-$version
rsync -av \
$OUTPUT_DIR/$genome_release/clinvar-minimal/. \
/tmp/for-upload/annonars-clinvar-minimal-$genome_release-$version/.
ls -lhR /tmp/for-upload/annonars-clinvar-minimal-$genome_release-$version
tar --directory=/tmp/for-upload --create --owner=0:0 --gzip \
--file /tmp/for-upload/annonars-clinvar-minimal-$genome_release-$version.tar.gz \
annonars-clinvar-minimal-$genome_release-$version
pushd /tmp/for-upload
sha256sum annonars-clinvar-minimal-$genome_release-$version.tar.gz \
> annonars-clinvar-minimal-$genome_release-$version.tar.gz.sha256
popd
gh release upload --clobber "annonars-data-clinvar-${{ inputs.release-name }}" \
/tmp/for-upload/annonars-clinvar-minimal-$genome_release-$version.tar.gz*
env:
GITHUB_TOKEN: ${{ inputs.token }}
# cf. https://github.com/mamba-org/provision-with-micromamba#important
shell: stdbuf -oL bash -l {0}