Skip to content

update-standard

update-standard #46

name: update-standard
on:
workflow_dispatch:
schedule:
- cron: '0 0 1 * *'
env:
PYTHON_VERSION: '3.12'
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 -j
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
continue-on-error: true
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
path: new_standard/
- name: Diff JSON files
run: echo "diff_lines=$(diff -qr standard new_standard | grep -v '.gitignore' | wc -l)" >> $GITHUB_OUTPUT
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
# temporary disable "publish to master", which may commit the changes in an unapproved PR
# - 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