feat,ci: refactor hermes workflow with Software CaRD stub #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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 | |
| # This trigger on closed pull requests is mandatory for the rest of the HERMES workflow. | |
| pull_request: | |
| types: | |
| - closed | |
| jobs: | |
| hermes-prepare: | |
| name: Prepare Metadata for Curation | |
| runs-on: ubuntu-latest | |
| if: > | |
| github.event_name == 'push' && ! ( | |
| startsWith(github.ref_name, 'hermes/') || | |
| contains(github.event.head_commit.message, 'hermes/post') | |
| ) | |
| 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' | |
| - 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/curation/* | |
| 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 Software CaRD report.' | tee -a report.md | |
| echo 'Report artifact at ${{ steps.upload-report.outputs.artifact-url }}' | tee -a report.md | |
| echo 'Rendered view at https://softwarepub.github.io/software-card/index.html?type=github&repoUrl=${{ github.repositoryUrl }}&artifactUrl=${{ 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: An example issue | |
| content-filepath: ./report.md | |
| #labels: | | |
| # report | |
| # automated issue | |
| - run: 'echo Created report in issue #${{ steps.create-report-issue.outputs.issue-number }}' | |