From 76bed03b52d1379f67e71f092289d691e8f085a1 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 14 Dec 2023 17:27:42 -0500 Subject: [PATCH 1/3] fix: prepare for artifact v4 Signed-off-by: Henry Schreiner --- .github/workflows/reusable-cookie.yml | 1 + docs/pages/guides/gha_pure.md | 10 +++++-- docs/pages/guides/gha_wheels.md | 26 ++++++++++++++----- ...ter.__type=='compiled' %}cd.yml{% endif %} | 10 ++++++- 4 files changed, 38 insertions(+), 9 deletions(-) diff --git a/.github/workflows/reusable-cookie.yml b/.github/workflows/reusable-cookie.yml index 946a3842..9ff3dfd3 100644 --- a/.github/workflows/reusable-cookie.yml +++ b/.github/workflows/reusable-cookie.yml @@ -171,6 +171,7 @@ jobs: - uses: actions/upload-artifact@v3 with: + name: Packages path: dist pass: diff --git a/docs/pages/guides/gha_pure.md b/docs/pages/guides/gha_pure.md index 582d28d1..27ec454d 100644 --- a/docs/pages/guides/gha_pure.md +++ b/docs/pages/guides/gha_pure.md @@ -79,6 +79,7 @@ dist: - uses: actions/upload-artifact@v3 with: + name: Packages path: dist/* - name: Check metadata @@ -104,6 +105,11 @@ GitHub Actions (in fact, they use it to setup other applications). We upload the artifact just to make it available via the GitHub PR/Checks API. You can download a file to test locally if you want without making a release. +{: .warning } + +> As of `upload-artifact@v4`, the artifact name must be unique. Extending an +> existing artifact is no longer supported. + We also add an optional check using twine for the metadata (it will be tested later in the upload action for the release job, as well). @@ -142,7 +148,7 @@ publish: steps: - uses: actions/download-artifact@v3 with: - name: artifact + name: Packages path: dist - uses: pypa/gh-action-pypi-publish@release/v1 @@ -168,7 +174,7 @@ publish: steps: - uses: actions/download-artifact@v3 with: - name: artifact + name: Packages path: dist - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/docs/pages/guides/gha_wheels.md b/docs/pages/guides/gha_wheels.md index 0bafe2c1..b65dd808 100644 --- a/docs/pages/guides/gha_wheels.md +++ b/docs/pages/guides/gha_wheels.md @@ -38,8 +38,8 @@ This will run on releases. If you use a develop branch, you could include `pull_request: branches: [stable]`, since it changes rarely. GitHub actions also [has a `workflow_dispatch` option][workflow_dispatch], which will allow you to click a button in the GUI to trigger a build, which is perfect for testing -wheels before making a release; you can download them from "artifacts". You can -even define variables that you can set in the GUI and access in the CI! +wheels before making a release; you can download them from the "artifacts". You +can even define variables that you can set in the GUI and access in the CI! [workflow_dispatch]: https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/ @@ -94,6 +94,7 @@ make_sdist: - uses: actions/upload-artifact@v3 with: + name: SDist path: dist/*.tar.gz ``` @@ -126,6 +127,7 @@ build_wheels: - name: Upload wheels uses: actions/upload-artifact@v3 with: + name: Wheels-${{ matrix.os }} path: wheelhouse/*.whl ``` @@ -177,8 +179,14 @@ upload_all: steps: - uses: actions/download-artifact@v3 with: - name: artifact - path: dist + path: all + + - name: Merge files + run: | + mkdir dist + mv all/*/* . + rmdir all/* + rmdir all - uses: pypa/gh-action-pypi-publish@release/v1 ``` @@ -203,8 +211,14 @@ upload_all: steps: - uses: actions/download-artifact@v3 with: - name: artifact - path: dist + path: all + + - name: Merge files + run: | + mkdir dist + mv all/*/* . + rmdir all/* + rmdir all - uses: pypa/gh-action-pypi-publish@release/v1 with: diff --git a/{{cookiecutter.project_name}}/.github/workflows/{% if cookiecutter.__type=='compiled' %}cd.yml{% endif %} b/{{cookiecutter.project_name}}/.github/workflows/{% if cookiecutter.__type=='compiled' %}cd.yml{% endif %} index a5a1b16e..50c3f8f3 100644 --- a/{{cookiecutter.project_name}}/.github/workflows/{% if cookiecutter.__type=='compiled' %}cd.yml{% endif %} +++ b/{{cookiecutter.project_name}}/.github/workflows/{% if cookiecutter.__type=='compiled' %}cd.yml{% endif %} @@ -27,6 +27,7 @@ jobs: - uses: actions/upload-artifact@v3 with: + name: SDist path: dist/*.tar.gz build_wheels: @@ -47,6 +48,7 @@ jobs: - name: Upload wheels uses: actions/upload-artifact@v3 with: + name: Wheel-{% raw %}${{ matrix.os }}{% endraw %} path: wheelhouse/*.whl upload_all: @@ -60,9 +62,15 @@ jobs: steps: - uses: actions/download-artifact@v3 with: - name: artifact path: dist + - name: Merge files + run: | + mkdir dist + mv all/*/* . + rmdir all/* + rmdir all + - uses: pypa/gh-action-pypi-publish@release/v1 with: # Remember to tell (test-)pypi about this repo before publishing From b2393dc56a452cd7fd4ee909b4a73335fd387501 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 14 Dec 2023 17:34:59 -0500 Subject: [PATCH 2/3] Apply suggestions from code review --- docs/pages/guides/gha_wheels.md | 2 -- .../{% if cookiecutter.__type=='compiled' %}cd.yml{% endif %} | 2 -- 2 files changed, 4 deletions(-) diff --git a/docs/pages/guides/gha_wheels.md b/docs/pages/guides/gha_wheels.md index b65dd808..3fa4e9a4 100644 --- a/docs/pages/guides/gha_wheels.md +++ b/docs/pages/guides/gha_wheels.md @@ -217,8 +217,6 @@ upload_all: run: | mkdir dist mv all/*/* . - rmdir all/* - rmdir all - uses: pypa/gh-action-pypi-publish@release/v1 with: diff --git a/{{cookiecutter.project_name}}/.github/workflows/{% if cookiecutter.__type=='compiled' %}cd.yml{% endif %} b/{{cookiecutter.project_name}}/.github/workflows/{% if cookiecutter.__type=='compiled' %}cd.yml{% endif %} index 50c3f8f3..9f45dc0f 100644 --- a/{{cookiecutter.project_name}}/.github/workflows/{% if cookiecutter.__type=='compiled' %}cd.yml{% endif %} +++ b/{{cookiecutter.project_name}}/.github/workflows/{% if cookiecutter.__type=='compiled' %}cd.yml{% endif %} @@ -68,8 +68,6 @@ jobs: run: | mkdir dist mv all/*/* . - rmdir all/* - rmdir all - uses: pypa/gh-action-pypi-publish@release/v1 with: From 0315693a3a07a480ac1d5d308121f41701bf5068 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Fri, 15 Dec 2023 23:14:27 -0500 Subject: [PATCH 3/3] Apply suggestions from code review --- docs/pages/guides/gha_wheels.md | 6 ++---- ...% if cookiecutter.__type=='compiled' %}cd.yml{% endif %} | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/docs/pages/guides/gha_wheels.md b/docs/pages/guides/gha_wheels.md index 3fa4e9a4..21add009 100644 --- a/docs/pages/guides/gha_wheels.md +++ b/docs/pages/guides/gha_wheels.md @@ -184,9 +184,7 @@ upload_all: - name: Merge files run: | mkdir dist - mv all/*/* . - rmdir all/* - rmdir all + mv all/*/* dist - uses: pypa/gh-action-pypi-publish@release/v1 ``` @@ -216,7 +214,7 @@ upload_all: - name: Merge files run: | mkdir dist - mv all/*/* . + mv all/*/* dist - uses: pypa/gh-action-pypi-publish@release/v1 with: diff --git a/{{cookiecutter.project_name}}/.github/workflows/{% if cookiecutter.__type=='compiled' %}cd.yml{% endif %} b/{{cookiecutter.project_name}}/.github/workflows/{% if cookiecutter.__type=='compiled' %}cd.yml{% endif %} index 9f45dc0f..7e7aabc8 100644 --- a/{{cookiecutter.project_name}}/.github/workflows/{% if cookiecutter.__type=='compiled' %}cd.yml{% endif %} +++ b/{{cookiecutter.project_name}}/.github/workflows/{% if cookiecutter.__type=='compiled' %}cd.yml{% endif %} @@ -67,7 +67,7 @@ jobs: - name: Merge files run: | mkdir dist - mv all/*/* . + mv all/*/* dist - uses: pypa/gh-action-pypi-publish@release/v1 with: