Skip to content

Create hgnc

Create hgnc #76

Workflow file for this run

name: Create NXOntology
run-name: Create ${{ inputs.source }}
on:
workflow_dispatch:
inputs:
source:
type: choice
description: 'Which data source to generate.'
options:
- efo
- hgnc
- mesh
- pubchem
- test # for testing this action
overwrite:
type: boolean
description: 'Overwrite output on an existing branch.'
default: false
permissions:
contents: write
jobs:
create-runner:
runs-on: ubuntu-latest
outputs:
label: ${{ steps.create-runner.outputs.label }}
steps:
- id: create-runner
uses: related-sciences/gce-github-runner@main
with:
token: ${{ secrets.GH_SA_TOKEN }}
project_id: ${{ secrets.GCP_PROJECT_ID }}
runner_service_account: ${{ secrets.GCP_SA }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
machine_type: n2-highmem-8
image_project: ubuntu-os-cloud
image_family: ubuntu-2004-lts
ephemeral: true
no_external_address: true
export:
needs: create-runner
runs-on: ${{ needs.create-runner.outputs.label }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup dependencies
uses: ./.github/actions/setup
- name: Set parameters
id: params
shell: bash
run: |
CURRENT_DATE=$(date --utc --iso)
echo "Setting parameter current_date=$CURRENT_DATE"
echo "current_date=$CURRENT_DATE" >> $GITHUB_OUTPUT
OUTPUT_PATH="output/${{ github.event.inputs.source }}"
echo "Setting parameter output_path=$OUTPUT_PATH"
echo "output_path=$OUTPUT_PATH" >> $GITHUB_OUTPUT
OUTPUT_EXISTS="true"
git ls-remote --exit-code origin $OUTPUT_PATH || OUTPUT_EXISTS="false"
echo "$OUTPUT_PATH branch exists on origin: $OUTPUT_EXISTS"
echo "output_exists=$OUTPUT_EXISTS" >> $GITHUB_OUTPUT
OVERWRITE=${{ github.event.inputs.overwrite || 'false' }}
echo "Setting parameter overwrite=$OVERWRITE"
echo "overwrite=$OVERWRITE" >> $GITHUB_OUTPUT
EXPORT="false"
if [[ $OUTPUT_EXISTS = "false" || $OVERWRITE = "true" ]]; then
EXPORT="true"
fi
echo "Setting parameter export=$EXPORT"
echo "export=$EXPORT" >> $GITHUB_OUTPUT
- name: Create output
id: extract
if: steps.params.outputs.export == 'true'
run: poetry run nxontology_data ${{ github.event.inputs.source }}
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
if: steps.params.outputs.export == 'true'
with:
folder: ./${{ steps.params.outputs.output_path }}
branch: ${{ steps.params.outputs.output_path }}
commit-message: |
Export ${{ github.event.inputs.source }} on ${{ steps.params.outputs.current_date }}
Ontology generated from source code at ${{ github.sha }}.
Run in https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
Triggered by @${{ github.actor }}.