From c5001948023b9da8151dd66825ed1c67a85fece3 Mon Sep 17 00:00:00 2001 From: Tom Morrell Date: Thu, 7 Nov 2024 15:36:26 -0800 Subject: [PATCH] Update iga.yaml --- .github/workflows/iga.yaml | 99 ++++++++++++++++++++++++++------------ 1 file changed, 69 insertions(+), 30 deletions(-) diff --git a/.github/workflows/iga.yaml b/.github/workflows/iga.yaml index 114d211..8c3da92 100644 --- a/.github/workflows/iga.yaml +++ b/.github/workflows/iga.yaml @@ -1,4 +1,4 @@ -name: InvenioRDM GitHub Archiver + env: INVENIO_SERVER: https://data.caltech.edu @@ -10,46 +10,51 @@ env: parent_record: "8ggc7-j3t22" debug: false -# ~~~~~~~~~~ The rest of this file should be left as-is ~~~~~~~~~~ + # This variable is a setting for post-archiving CodeMeta file updates. + # If you don't have a CodeMeta file, you can remove the add_doi_codemeta + # and CodeMeta2CFF jobs at the bottom of this file. + ref: main + +# ╭────────────────────────────────────────────╮ +# │ The rest of this file should be left as-is │ +# ╰────────────────────────────────────────────╯ + +name: InvenioRDM GitHub Archiver on: release: types: [published] workflow_dispatch: inputs: release_tag: - description: "The tag of the release to archive:" + description: The release tag (empty = latest) + parent_record: + description: ID of parent record (for versioning) + community: + description: Name of InvenioRDM community (if any) draft: - default: false - description: "Mark the record as a draft:" + description: Mark the record as a draft + type: boolean all_assets: - default: false - description: "Attach all GitHub assets:" + description: Attach all GitHub assets + type: boolean all_metadata: - default: false - description: "Include additional GitHub metadata:" - community: - description: "Send record to InvenioRDM community:" - parent_record: - description: "ID of parent record (for versioning):" + description: Include additional GitHub metadata + type: boolean + debug: + description: Print debug info in the GitHub log + type: boolean + +run-name: Archive ${{inputs.release_tag || 'latest release'}} in InvenioRDM jobs: - CodeMeta2CFF: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Convert CFF - uses: caltechlibrary/codemeta2cff@main - - name: Commit CFF - uses: EndBug/add-and-commit@v9 - with: - message: 'Add CITATION.cff for release' - add: "['CITATION.cff']" run_iga: - name: "Send to ${{needs.get_repository.outputs.server}}" + name: Send to ${{needs.get_repository.outputs.server}} runs-on: ubuntu-latest - needs: [get_repository, CodeMeta2CFF] + needs: get_repository + outputs: + record_doi: ${{steps.iga.outputs.record_doi}} steps: - - uses: caltechlibrary/iga@main + - uses: caltechlibrary/iga@v1 + id: iga with: INVENIO_SERVER: ${{env.INVENIO_SERVER}} INVENIO_TOKEN: ${{secrets.INVENIO_TOKEN}} @@ -61,10 +66,44 @@ jobs: parent_record: ${{github.event.inputs.parent_record || env.parent_record}} release_tag: ${{github.event.inputs.release_tag || 'latest'}} get_repository: - name: "Get repository name" + name: Get repository name runs-on: ubuntu-latest outputs: server: ${{steps.parse.outputs.host}} steps: - - id: parse + - name: Extract name from INVENIO_SERVER + id: parse run: echo "host=$(cut -d'/' -f3 <<< ${{env.INVENIO_SERVER}} | cut -d':' -f1)" >> $GITHUB_OUTPUT + add_doi_codemeta: + name: "Add ${{needs.run_iga.outputs.record_doi}} to codemeta.json" + needs: run_iga + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ env.ref }} + - name: Install sde + run: pip install sde + - name: Add DOI to CodeMeta File + run: sde identifier ${{needs.run_iga.outputs.record_doi}} codemeta.json + - name: Commit CFF + uses: EndBug/add-and-commit@v9 + with: + message: 'Add DOI to codemeta.json file' + add: 'codemeta.json' + CodeMeta2CFF: + runs-on: ubuntu-latest + needs: add_doi_codemeta + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ env.ref }} + - name: Convert CFF + uses: caltechlibrary/codemeta2cff@main + - name: Commit CFF + uses: EndBug/add-and-commit@v9 + with: + message: 'Add updated CITATION.cff from codemeta.json file' + add: 'CITATION.cff'