Skip to content

chore: publish json schemas as release artifacts #9

chore: publish json schemas as release artifacts

chore: publish json schemas as release artifacts #9

Workflow file for this run

name: Create and upload release artifacts
on:
release:
types: [published, prereleased]
# temporary PR trigger for test
pull_request:
branches:
- develop
- 'features/**'
jobs:
release-artifacts:
runs-on: ubuntu-latest
permissions:
contents: write
repository-projects: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install Poetry
run: python -m pip install poetry
- name: Install dependencies
run: poetry install
- name: Make release artifacts
run: |
mkdir -p ./dist/schemas
poetry run ./manage.py schemas phenopacket >> ./dist/schemas/phenopacket_schema.json
poetry run ./manage.py schemas experiment >> ./dist/schemas/experiment_schema.json
poetry run ./manage.py schemas discovery >> ./dist/schemas/discovery.json
zip -r json-schemas.zip ./dist/schemas
- name: Upload release artifacts
uses: actions/github-script@v7
with:
script: |
const fs = require("fs");
// temporary hardcoding for test
const tag = "v8.0.2-test";
// const tag = context.ref.replace("refs/tags/", "");
console.log("tag = ", tag);
const release = await github.rest.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag: tag,
});
console.log("release id = ", release.data.id)
await github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release.data.id,
name: "json-schemas.zip",
data: await fs.readFileSync("./json-schemas.zip"),
});