Skip to content

update-standard

update-standard #38

name: update-standard
on:
workflow_dispatch:
schedule:
- cron: '0 0 1 * *'
env:
PYTHON_VERSION: '3.7'
DICOM_VERSION: 'current'
jobs:
make:
name: Run make
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run Makefile (DICOM version ${{ env.DICOM_VERSION }})
run: |
make clean
make updatestandard VERSION='${{ env.DICOM_VERSION }}'
make
working-directory: dicom_standard
- name: Upload JSON files
uses: actions/upload-artifact@v4
with:
name: new_standard
path: dicom_standard/dist
test-and-commit:
needs: make
name: Run tox and commit to master
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip tox
pip install -r requirements.txt
- name: Download updated standard
uses: actions/download-artifact@v4
with:
name: new_standard
- name: Diff JSON files
run: echo ::set-output name=diff_lines::$(diff -qr standard new_standard | grep -v ".gitignore" | wc -l)
id: diff_files
- name: Update standard
run: |
mv new_standard/*.json standard
rm -rf new_standard
if: steps.diff_files.outputs.diff_lines > 0
- name: Run tests
run: tox
- name: Publish to master
uses: mikeal/publish-to-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: success() && steps.diff_files.outputs.diff_lines > 0