-
Notifications
You must be signed in to change notification settings - Fork 0
122 lines (97 loc) · 4.49 KB
/
hermes_github.yml
File metadata and controls
122 lines (97 loc) · 4.49 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
# SPDX-FileCopyrightText: 2023 German Aerospace Center (DLR), Forschungszentrum Jülich, Helmholtz-Zentrum Dresden-Rossendorf
#
# SPDX-License-Identifier: CC0-1.0
name: Software Publication
on:
# This trigger on branches being pushed starts the HERMES pipeline.
push:
branches:
- main
issue_comment:
types: [created]
jobs:
hermes-prepare:
name: Prepare Metadata for Curation
runs-on: ubuntu-latest
# Only run on push events
if: github.event_name == 'push'
permissions:
contents: read
issues: write # Allow creating new issues with the reports from Software CaRD
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3.12'
# For now, skip using hermes - we're just testing CI here
#- run: pip install hermes
#- run: pip install git+https://github.com/softwarepub/hermes-plugin-git
#- run: hermes harvest
#- run: hermes process
# This is where we will run the Software CaRD plugin (later)
# - run: hermes curate
# Create a stub report
- run: |
mkdir -p .hermes/curate
echo '{"test": "foobar"}' > ./.hermes/curate/report
# Upload artifact (there are no real file attachments for issues and the max length may impose problems later, so we can't just use a <details> tag)
- id: upload-report
uses: actions/upload-artifact@v6
with:
name: softwarecard-report
path: ./.hermes/curate/*
if-no-files-found: 'error'
retention-days: 90
- run: 'echo Report artifact accessible at ${{ steps.upload-report.outputs.artifact-url }}'
- run: |
echo 'This is a stub message for a future Software CaRD report.' | tee -a ./report.md
echo 'View rendered version in the [Software CaRD SPA](https://softwarepub.github.io/software-card/index.html?type=github&repoUrl=${{ github.repositoryUrl }}&artifactUrl=${{ steps.upload-report.outputs.artifact-url }})' | tee -a ./report.md
echo '' | tee -a ./report.md
echo 'Created by hermes in [action run no. ${{ github.run_id }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})' | tee -a ./report.md
echo 'Find report artifact at [here](${{ steps.upload-report.outputs.artifact-url }})' | tee -a ./report.md
# Now create an issue and add the Software CaRD report
- name: Create Issue From File
uses: peter-evans/create-issue-from-file@v6
with:
title: Release 0.0.0 Curation Report
content-filepath: ./report.md
#labels: |
# report
# automated issue
- run: 'echo Created report in issue #${{ steps.create-report-issue.outputs.issue-number }}'
hermes-publish:
name: Publish after curation accepted
runs-on: ubuntu-latest
# The bit about who may run this job may be better put into steps, so we can extract from some configuration.
# The goal: only react to comments from curators!
if: >
github.event_name == 'issue_comment' &&
github.event.comment.author_association == 'MEMBER' &&
contains(github.event.comment.body, '/hermes publish')
steps:
- run: echo 'Curation was successful. Publishing now.'
# TODO: We need to figure out what should be checked out here!
# Ideas: extract from comment? find issue and extract from artifact?
# Caveats: make sure this is not an old issue and the artifact is still there...
#- uses: actions/checkout@v6
#- uses: actions/setup-python@v6
# with:
# python-version: '3.12'
# For now, skip using hermes - we're just testing CI here
#- run: pip install hermes
#- run: pip install git+https://github.com/softwarepub/hermes-plugin-git
# - run: hermes deposit
# - run: hermes post-process
# TODO: it would probably be a good idea to close the curation issue here. Maybe some other cleanup, too?
hermes-cleanup:
name: Cleanup after curation rejected
runs-on: ubuntu-latest
# The bit about who may run this job may be better put into steps, so we can extract from some configuration.
# The goal: only react to comments from curators!
if: >
github.event_name == 'issue_comment' &&
github.event.comment.author_association == 'MEMBER' &&
contains(github.event.comment.body, '/hermes reject')
steps:
- run: echo 'Curation was rejected. Cleaning up now.'
# TODO: do some cleanup here.