Skip to content

Commit

Permalink
chore: release gh actions workflow test
Browse files Browse the repository at this point in the history
  • Loading branch information
v-rocheleau committed Sep 17, 2024
1 parent a40ebdc commit fe02f36
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 14 deletions.
14 changes: 0 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,3 @@ jobs:
image-name: ghcr.io/bento-platform/katsu
development-dockerfile: bento.dev.Dockerfile
dockerfile: bento.Dockerfile

# TODO: test, maybe just add to a protected build directory?
- name: Make release artifacts
run: |
mkdir -p ./dist/schemas
./manage.py schema phenopacket >> ./dist/schemas/phenopacket_schema.json
./manage.py schema experiment >> ./dist/schemas/experiment_schema.json
./manage.py schema discovery >> ./dist/schemas/discovery.json
- name: Upload release artifacts
uses: actions/upload-artifact@v4
with:
name: JSON-schemas
path: ./dist/schemas
59 changes: 59 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
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: read

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
./manage.py schema phenopacket >> ./dist/schemas/phenopacket_schema.json
./manage.py schema experiment >> ./dist/schemas/experiment_schema.json
./manage.py schema discovery >> ./dist/schemas/discovery.json
- name: Upload release artifacts
uses: actions/github-scripts@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
});
await github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release.data.id,
name: "JSON Schemas",
data: await fs.readdirSync("./dist/schemas")
});

0 comments on commit fe02f36

Please sign in to comment.