Archive latest release in InvenioRDM #54
This file contains 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
# ╭─────────────────── Notice ── Notice ── Notice ───────────────────╮ | |
# │ This is a custom IGA workflow file. It is different from the │ | |
# │ sample workflow suggested for users because using IGA with IGA │ | |
# │ leads to a chicken-and-egg problem. │ | |
# │ │ | |
# │ DO NOT USE THIS WORKFLOW FOR YOUR OWN SOFTWARE. Instead, use the │ | |
# │ recommended sample workflow for IGA, which is available as the │ | |
# │ file "sample-workflow.yml" from the IGA source repository at │ | |
# │ https://github.com/caltechlibrary/iga/. │ | |
# ╰─────────────────── Notice ── Notice ── Notice ───────────────────╯ | |
# This workflow uses the latest copy of IGA in the GitHub development | |
# branch rather than the copy of IGA on PyPI. This makes it possible | |
# to release IGA normally and have the latest version of IGA be the | |
# version that the GHA workflow runs to archive the release in our | |
# RDM server. (The normal suggested workflow runs the PyPI version. | |
# If we used *that* version instead of this special version, the | |
# workflow would end up running the *previous* version of IGA because | |
# we don't update PyPI until *after* the release is made on GitHub. | |
# While running the old version is not always a problem, it is if the | |
# new version has a bug fix or change that we want to take advantage | |
# of when we send the archive to our RDM server. Running the latest | |
# version to do our archiving also acts as an additional error check.) | |
env: | |
# 👋🏻 Set the next variable to your InvenioRDM server address 👋🏻 | |
INVENIO_SERVER: https://data.caltech.edu | |
# Set to an InvenioRDM record ID to mark release as a new version. | |
parent_record: htgnd-z2954 | |
# The variables below are other IGA options. Please see the docs. | |
community: none | |
draft: false | |
all_assets: false | |
all_metadata: false | |
debug: true | |
name: InvenioRDM GitHub Archiver | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
inputs: | |
release_tag: | |
description: The release tag (empty = latest) | |
parent_record: | |
description: ID of parent record (for versioning) | |
community: | |
description: Name of InvenioRDM community (if any) | |
draft: | |
description: Mark the record as a draft | |
type: boolean | |
all_assets: | |
description: Attach all GitHub assets | |
type: boolean | |
all_metadata: | |
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: | |
run_iga: | |
name: Send to ${{needs.get_repository.outputs.server}} | |
runs-on: ubuntu-latest | |
needs: get_repository | |
steps: | |
- uses: caltechlibrary/iga@develop | |
with: | |
INVENIO_SERVER: ${{env.INVENIO_SERVER}} | |
INVENIO_TOKEN: ${{secrets.INVENIO_TOKEN}} | |
all_assets: ${{github.event.inputs.all_assets || env.all_assets}} | |
all_metadata: ${{github.event.inputs.all_metadata || env.all_metadata}} | |
debug: ${{github.event.inputs.debug || env.debug}} | |
draft: ${{github.event.inputs.draft || env.draft}} | |
community: ${{github.event.inputs.community || env.community}} | |
parent_record: ${{github.event.inputs.parent_record || env.parent_record}} | |
release_tag: ${{github.event.inputs.release_tag || 'latest'}} | |
iga_copy: git+https://github.com/caltechlibrary/iga@develop | |
get_repository: | |
name: Get repository name | |
runs-on: ubuntu-latest | |
outputs: | |
server: ${{steps.parse.outputs.host}} | |
steps: | |
- name: Extract name from INVENIO_SERVER | |
id: parse | |
run: echo "host=$(cut -d'/' -f3 <<< ${{env.INVENIO_SERVER}} | cut -d':' -f1)" >> $GITHUB_OUTPUT |