-
Notifications
You must be signed in to change notification settings - Fork 3
82 lines (82 loc) · 2.84 KB
/
create.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Create NXOntology
on:
# schedule:
# # https://crontab.guru/#05_11_*_*_2
# - cron: '05 11 * * 2'
workflow_dispatch:
inputs:
source:
type: choice
description: 'Which data source to generate.'
options:
- mesh
- pubchem
- test # for testing this action
overwrite:
type: boolean
description: 'Overwrite output on an existing branch.'
default: false
permissions: write-all
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
export:
needs: create-runner
runs-on: ${{ needs.create-runner.outputs.label }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup dependencies
uses: ./.github/actions/setup
- name: Set parameters
id: params
shell: bash
run: |
OUTPUT_PATH="output/${{ github.event.inputs.source }}"
echo "Setting parameter output_path=$OUTPUT_PATH"
echo "::set-output name=output_path::$OUTPUT_PATH"
OUTPUT_EXISTS="true"
git ls-remote --exit-code origin $OUTPUT_PATH || OUTPUT_EXISTS="false"
echo "$OUTPUT_PATH branch exists on origin: $OUTPUT_EXISTS"
echo "::set-output name=output_exists::$OUTPUT_EXISTS"
OVERWRITE=${{ github.event.inputs.overwrite || 'false' }}
echo "Setting parameter overwrite=$OVERWRITE"
echo "::set-output name=overwrite::$OVERWRITE"
EXPORT="false"
if [[ $OUTPUT_EXISTS = "false" || $OVERWRITE = "true" ]]; then
EXPORT="true"
fi
echo "Setting parameter export=$EXPORT"
echo "::set-output name=export::$EXPORT"
- name: Create output
id: extract
if: steps.params.outputs.export == 'true'
run: poetry run nxontology_data ${{ github.event.inputs.source }}
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: steps.params.outputs.export == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: ${{ steps.params.outputs.output_path }}
publish_dir: ${{ steps.params.outputs.output_path }}
# Won't actually enable jekyll because we're not using GitHub Pages.
# https://github.com/peaceiris/actions-gh-pages/issues/660
enable_jekyll: true
- name: Stop GCE runner
if: always()
uses: related-sciences/gce-github-runner@main
with:
command: stop