Publish data dump to Zenodo #46
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
name: Publish data dump to Zenodo | |
on: | |
workflow_dispatch: | |
inputs: | |
release: | |
required: true | |
type: string | |
description: Release version (ex v1.17) | |
zenodo-env: | |
required: true | |
description: Zenodo environment | |
default: 'prod' | |
type: choice | |
options: | |
- sandbox | |
- prod | |
record-id: | |
required: true | |
type: string | |
description: Parent Zenodo record ID (if different from default) | |
default: '6347575' | |
env: | |
ZENODO_TOKEN_SANDBOX: ${{ secrets.ZENODO_TOKEN_SANDBOX }} | |
ZENODO_TOKEN_PROD: ${{ secrets.ZENODO_TOKEN_PROD }} | |
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
PERSONAL_ACCESS_TOKEN_USER: ${{ secrets.PERSONAL_ACCESS_TOKEN_USER }} | |
jobs: | |
publish-dump: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Echo message | |
id: echo_message | |
run: echo "Github action triggered with inputs release ${{github.event.inputs.release}}, Zenodo env ${{github.event.inputs.zenodo-env}}, parent record ID ${{github.event.inputs.record-id}}" | |
- name: checkout ror data repo | |
uses: actions/checkout@v2 | |
with: | |
repository: ror-community/ror-data | |
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
path: ./ror-data | |
- name: Set up Python environment | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.8" | |
- name: execute script | |
id: publishdumpscript | |
run: | | |
cd ./ror-data | |
python -m pip install --upgrade pip | |
curl https://raw.githubusercontent.com/ror-community/curation_ops/v2-crosswalk/upload_dump_zenodo/requirements.txt -o requirements.txt | |
pip install -r requirements.txt | |
curl https://raw.githubusercontent.com/ror-community/curation_ops/v2-crosswalk/upload_dump_zenodo/upload_dump_zenodo.py -o upload_dump_zenodo.py | |
python upload_dump_zenodo.py -r ${{github.event.inputs.release}} -p ${{github.event.inputs.record-id}} -e ${{github.event.inputs.zenodo-env}} | |
- name: Notify Slack | |
if: always() | |
uses: edge/simple-slack-notify@master | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.CURATOR_SLACK_WEBHOOK_URL }} | |
with: | |
channel: '#ror-curation-releases' | |
color: 'good' | |
text: 'PROD Data dump ${{github.event.inputs.release}} Zenodo publication status: ${{ steps.publishdumpscript.outcome }} Please check: ${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}' |