qurator-spk / setuptools_ocrd

Manage your package version through ocrd-tool.json
Apache License 2.0
1 stars 0 forks source link

Make release workflow reusable #9

Open mikegerber opened 1 year ago

mikegerber commented 1 year ago

The workflow in release.yml should be reusable in other projects (e.g. dinglehopper)

mikegerber commented 1 year ago

Blocked by:

I couldn't even make it work with an in-repo reusable workflow (secrets: inherit didn't have the effect, but I made have overseen sth else)

mikegerber commented 1 year ago

Here the same for dinglehopper:

grafik

There's small differences that I should resolve:

❯ diff -u {setuptools_ocrd,dinglehopper}/.github/workflows/release.yml
--- setuptools_ocrd/.github/workflows/release.yml       2023-08-02 19:07:47.907186700 +0200
+++ dinglehopper/.github/workflows/release.yml  2023-08-04 19:45:35.654440100 +0200
@@ -6,20 +6,31 @@
       - "v*.*.*"

 env:
-  PYPI_URL: https://pypi.org/p/setuptools-ocrd
+  PYPI_URL: https://pypi.org/p/dinglehopper

 jobs:
+  test:
+    uses: ./.github/workflows/test.yml
+
   build:
+    needs: test
     runs-on: ubuntu-latest
     steps:
       - name: Checkout
         uses: actions/checkout@v3
+      - name: Upgrade pip
+        run: python3 -m pip install --upgrade pip
+      - name: Install setuptools
+        run: |
+          python3 -m pip install --upgrade setuptools
+          # For OCR-D tools, we need setuptools-ocrd to get the version
+          if [ -e ocrd-tool.json ]; then
+            python3 -m pip install setuptools-ocrd
+          fi
       - name: Check git tag vs package version
-        run: python3 -m pip install --upgrade setuptools && .github/workflows/release-check-version-tag
+        run: .github/workflows/release-check-version-tag
       - name: Build package
         run: python3 -m pip install --upgrade build && python3 -m build
-      - name: Test
-        run: python3 -m pip install -r requirements-dev.txt && pytest
       - name: Upload dist
         uses: actions/upload-artifact@v3
         with:

@kba If you're interested, I'd also like your opinion on this (not on the difference but on the release workflow ;))