From 2b207809d5074677a73977b42556deda3f639ae6 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Mon, 17 Jun 2024 20:00:06 +0200 Subject: [PATCH 01/10] add release workflow --- ...onpackage.yml => validate_and_release.yml} | 40 +++++++++++-------- 1 file changed, 24 insertions(+), 16 deletions(-) rename .github/workflows/{pythonpackage.yml => validate_and_release.yml} (51%) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/validate_and_release.yml similarity index 51% rename from .github/workflows/pythonpackage.yml rename to .github/workflows/validate_and_release.yml index 337730f6b..11682df9a 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/validate_and_release.yml @@ -1,19 +1,19 @@ -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - -name: Python package +# - validate the protocol and activities in the repo with reproschema.py +# - triggers a release when a github release is published +name: validate and release on: push: - branches: [ main ] + branches: + - main pull_request: - branches: '*' + branches: ['*'] + release: + types: [published] jobs: - build: - + validate: runs-on: ubuntu-latest - steps: - uses: actions/checkout@v4 - name: Set up Python @@ -26,14 +26,22 @@ jobs: run: | python -m pip install --upgrade pip setuptools pip install git+https://github.com/ReproNim/reproschema-py.git - - name: Test with pyshacl + - name: Validate content run: | python scripts/jsonParser.py reproschema validate examples - # TODO adapt make release - # TODO use mkdocs macro to update doc content - # - name: Make a release - # run: | + + release: + needs: [validate] + if: github.repository == 'ReproNim/reproschema' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.12 + - name: Make a release + run: | + echo "Making a release" # python scripts/makeRelease.py ci-release - # pip install pytablewriter - # python scripts/editProperties.py ci-release From d592050d1fdd185ff09403ee15827adcf9e05f84 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Mon, 17 Jun 2024 20:06:09 +0200 Subject: [PATCH 02/10] give me the context --- .github/workflows/validate_and_release.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/validate_and_release.yml b/.github/workflows/validate_and_release.yml index 11682df9a..a27140820 100644 --- a/.github/workflows/validate_and_release.yml +++ b/.github/workflows/validate_and_release.yml @@ -15,6 +15,10 @@ jobs: validate: runs-on: ubuntu-latest steps: + - name: Dump GitHub context1 + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 From ed9018ac4c124cb629ef3f3c9f39aff6b8f5522c Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Mon, 17 Jun 2024 20:09:26 +0200 Subject: [PATCH 03/10] release trigger --- .github/workflows/validate_and_release.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/validate_and_release.yml b/.github/workflows/validate_and_release.yml index a27140820..6404cb148 100644 --- a/.github/workflows/validate_and_release.yml +++ b/.github/workflows/validate_and_release.yml @@ -15,10 +15,6 @@ jobs: validate: runs-on: ubuntu-latest steps: - - name: Dump GitHub context1 - env: - GITHUB_CONTEXT: ${{ toJson(github) }} - run: echo "$GITHUB_CONTEXT" - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 @@ -37,7 +33,8 @@ jobs: release: needs: [validate] - if: github.repository == 'ReproNim/reproschema' + # if: github.repository == 'ReproNim/reproschema' + if: ${{ github.event_name }} == 'release' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 From 730f298c7e7a9bef492eb4401c836d5529edc740 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Mon, 17 Jun 2024 20:13:44 +0200 Subject: [PATCH 04/10] update readme --- README.md | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 50b5195ad..66f4e3f7d 100644 --- a/README.md +++ b/README.md @@ -35,18 +35,15 @@ The content of this repository is distributed under the [Apache 2.0 license](./L https://github.com/ReproNim/reproschema/graphs/contributors ### Developer notes -To run the Python scripts in the scripts directory, you will need to install the -following libraries via pip + +To run the Python scripts in the scripts directory, +you will need to install the following libraries via pip - reproschema (makeRelease.py) -- pytablewriter (editProperties.py) -To make a new release: +A new release can be triggered by making a Github release: -```bash -python scripts/makeRelease.py -python scripts/editProperties.py -``` +## Style guide In addition, this repo uses pre-commit to check styling. From ec0b35628f97c17e88c41c7c983f08c0bd74ab22 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Mon, 17 Jun 2024 20:13:48 +0200 Subject: [PATCH 05/10] update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 66f4e3f7d..003771180 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ you will need to install the following libraries via pip - reproschema (makeRelease.py) -A new release can be triggered by making a Github release: +A new release can be triggered by making a [Github release](https://github.com/ReproNim/reproschema/releases). ## Style guide From 972b299957d0a1351d5267f6fdb59bd959dc0296 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Mon, 17 Jun 2024 20:15:47 +0200 Subject: [PATCH 06/10] fci --- .github/workflows/validate_and_release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/validate_and_release.yml b/.github/workflows/validate_and_release.yml index 6404cb148..8f5b8ee5b 100644 --- a/.github/workflows/validate_and_release.yml +++ b/.github/workflows/validate_and_release.yml @@ -45,4 +45,5 @@ jobs: - name: Make a release run: | echo "Making a release" + echo ${{ github.event_name }} # python scripts/makeRelease.py ci-release From 5a576ef9489ada8d734f8373b44e1646884e8dce Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Mon, 17 Jun 2024 20:17:40 +0200 Subject: [PATCH 07/10] fci --- .github/workflows/validate_and_release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/validate_and_release.yml b/.github/workflows/validate_and_release.yml index 8f5b8ee5b..c876f7d34 100644 --- a/.github/workflows/validate_and_release.yml +++ b/.github/workflows/validate_and_release.yml @@ -34,7 +34,7 @@ jobs: release: needs: [validate] # if: github.repository == 'ReproNim/reproschema' - if: ${{ github.event_name }} == 'release' + if: github.event_name == 'release' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 From e88453503f2b2d65df8f4c2bf6f1b0b9d7281c7a Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Mon, 17 Jun 2024 20:18:54 +0200 Subject: [PATCH 08/10] rm comment --- .github/workflows/validate_and_release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/validate_and_release.yml b/.github/workflows/validate_and_release.yml index c876f7d34..253410d1b 100644 --- a/.github/workflows/validate_and_release.yml +++ b/.github/workflows/validate_and_release.yml @@ -33,7 +33,6 @@ jobs: release: needs: [validate] - # if: github.repository == 'ReproNim/reproschema' if: github.event_name == 'release' runs-on: ubuntu-latest steps: From 8eaff9c1f9812114902fe6696c7e90df035d18e6 Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Mon, 17 Jun 2024 20:39:47 +0200 Subject: [PATCH 09/10] reset readme --- README.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 003771180..50b5195ad 100644 --- a/README.md +++ b/README.md @@ -35,15 +35,18 @@ The content of this repository is distributed under the [Apache 2.0 license](./L https://github.com/ReproNim/reproschema/graphs/contributors ### Developer notes - -To run the Python scripts in the scripts directory, -you will need to install the following libraries via pip +To run the Python scripts in the scripts directory, you will need to install the +following libraries via pip - reproschema (makeRelease.py) +- pytablewriter (editProperties.py) -A new release can be triggered by making a [Github release](https://github.com/ReproNim/reproschema/releases). +To make a new release: -## Style guide +```bash +python scripts/makeRelease.py +python scripts/editProperties.py +``` In addition, this repo uses pre-commit to check styling. From 2eb93cad201fbffa5a3dc3dcba16c5fab7d97a7c Mon Sep 17 00:00:00 2001 From: Remi Gau Date: Mon, 17 Jun 2024 21:11:05 +0200 Subject: [PATCH 10/10] try workflow_dispatch --- .github/workflows/validate_and_release.yml | 29 +++++++++++++++++----- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/.github/workflows/validate_and_release.yml b/.github/workflows/validate_and_release.yml index 253410d1b..573456ab2 100644 --- a/.github/workflows/validate_and_release.yml +++ b/.github/workflows/validate_and_release.yml @@ -8,8 +8,13 @@ on: - main pull_request: branches: ['*'] - release: - types: [published] + # Allow to trigger the generation of release files automatically + workflow_dispatch: + inputs: + version: + description: 'version number' + required: true + type: string jobs: validate: @@ -33,7 +38,7 @@ jobs: release: needs: [validate] - if: github.event_name == 'release' + if: github.event == 'workflow_dispatch' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -41,8 +46,20 @@ jobs: uses: actions/setup-python@v5 with: python-version: 3.12 + - name: Make a release run: | - echo "Making a release" - echo ${{ github.event_name }} - # python scripts/makeRelease.py ci-release + echo "Making a release ${{ inputs.version }}" + mkdir releases/${{ inputs.version }} + cp contexts/reproschema releases/${{ inputs.version }}/base + # python scripts/makeRelease.py ${{ inputs.version }} + + - name: Open pull requests to add files + uses: peter-evans/create-pull-request@v6 + with: + commit-message: "[REL] adding files to for release ${{ inputs.version }}" + base: main + token: ${{ secrets.GITHUB_TOKEN }} + delete-branch: true + title: "[REL] adding files to for release ${{ inputs.version }}" + body: done via this [GitHub Action](https://github.com/${{ github.repository_owner }}/reproschema/blob/main/.github/workflows/validate_and_release.yml)