|
| 1 | +# - validate the protocol and activities in the repo with reproschema.py |
| 2 | +# - triggers a release when a github release is published |
| 3 | +name: validate and release |
| 4 | + |
| 5 | +on: |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - main |
| 9 | + pull_request: |
| 10 | + branches: ['*'] |
| 11 | + # Allow to trigger the generation of release files automatically |
| 12 | + workflow_dispatch: |
| 13 | + inputs: |
| 14 | + version: |
| 15 | + description: 'version number' |
| 16 | + required: true |
| 17 | + type: string |
| 18 | + |
| 19 | +jobs: |
| 20 | + validate: |
| 21 | + runs-on: ubuntu-latest |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v4 |
| 24 | + - name: Set up Python |
| 25 | + uses: actions/setup-python@v5 |
| 26 | + with: |
| 27 | + python-version: 3.12 |
| 28 | + - name: Install dependencies |
| 29 | + # TODO This installs reproschema from source and not from pypi |
| 30 | + # This may not be the optimal way of doing it. |
| 31 | + run: | |
| 32 | + python -m pip install --upgrade pip setuptools |
| 33 | + pip install git+https://github.com/ReproNim/reproschema-py.git |
| 34 | + - name: Validate content |
| 35 | + run: | |
| 36 | + python scripts/jsonParser.py |
| 37 | + reproschema validate examples |
| 38 | +
|
| 39 | + release: |
| 40 | + needs: [validate] |
| 41 | + if: github.event_name == 'workflow_dispatch' |
| 42 | + runs-on: ubuntu-latest |
| 43 | + steps: |
| 44 | + - uses: actions/checkout@v4 |
| 45 | + - name: Set up Python |
| 46 | + uses: actions/setup-python@v5 |
| 47 | + with: |
| 48 | + python-version: 3.12 |
| 49 | + |
| 50 | + - name: Make a release |
| 51 | + run: | |
| 52 | + echo "Making a release ${{ inputs.version }}" |
| 53 | + mkdir releases/${{ inputs.version }} |
| 54 | + cp contexts/reproschema releases/${{ inputs.version }}/base |
| 55 | + # python scripts/makeRelease.py ${{ inputs.version }} |
| 56 | + |
| 57 | + - name: Open pull requests to add files |
| 58 | + uses: peter-evans/create-pull-request@v6 |
| 59 | + with: |
| 60 | + commit-message: "[REL] adding files to for release ${{ inputs.version }}" |
| 61 | + base: main |
| 62 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 63 | + delete-branch: true |
| 64 | + title: "[REL] adding files to for release ${{ inputs.version }}" |
| 65 | + body: done via this [GitHub Action](https://github.com/${{ github.repository_owner }}/reproschema/blob/main/.github/workflows/validate_and_release.yml) |
0 commit comments