From 1fd05546b0dd586d180c43bfb55c5fdbc8b3274c Mon Sep 17 00:00:00 2001 From: "Daniel A. Wozniak" Date: Fri, 6 Sep 2024 23:36:38 -0700 Subject: [PATCH] Update workflows to prepare for release --- .github/workflows/ci.yml | 27 +++++++------ .github/workflows/deploy-package-action.yml | 43 ++++++++++++++------- .github/workflows/package-action.yml | 26 +++++++++++-- 3 files changed, 67 insertions(+), 29 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 151a11e..0839f72 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,7 @@ jobs: outputs: changed-files: ${{ toJSON(steps.changed-files.outputs) }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Get Changed Files id: changed-files uses: dorny/paths-filter@v2 @@ -91,11 +91,9 @@ jobs: - test - test-python-package - build-python-package - secrets: - PYPI_API_TOKEN: "${{ secrets.PYPI_API_TOKEN }}" - push-tag: - name: Push Version Tag + create-release: + name: Create Github Release runs-on: ubuntu-latest permissions: contents: write @@ -104,13 +102,18 @@ jobs: - build-python-package - deploy-python-package steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Push Tag - uses: rickstaa/action-create-tag@v1 + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token with: - tag: "v${{ needs.build-python-package.outputs.version }}" - message: "Version ${{ needs.build-python-package.outputs.version }}" + tag_name: "v${{ needs.build-python-package.outputs.version }}" + release_name: "Release v${{ needs.build-python-package.outputs.version }}" + body: | + Release ${{ needs.build-python-package.outputs.version }} + draft: false + prerelease: false set-pipeline-exit-status: # This step is just so we can make github require this step, to pass checks @@ -122,7 +125,7 @@ jobs: - pre-commit - test - deploy-python-package - - push-tag + - create-release steps: - name: Get workflow information id: get-workflow-info diff --git a/.github/workflows/deploy-package-action.yml b/.github/workflows/deploy-package-action.yml index 27605e1..f446b0b 100644 --- a/.github/workflows/deploy-package-action.yml +++ b/.github/workflows/deploy-package-action.yml @@ -1,22 +1,37 @@ name: Relenv Python Package -on: - workflow_call: - secrets: - PYPI_API_TOKEN: - required: true +on: workflow_call jobs: build: name: Publish Python Wheel runs-on: ubuntu-latest steps: - - name: Download Python Package Artifacts - uses: actions/download-artifact@v3 - with: - name: dist - path: dist - - name: Publish distribution to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - password: ${{ secrets.PYPI_API_TOKEN }} + - name: Download Source Tarball + uses: actions/download-artifact@v4 + with: + name: Source Tarball + path: dist + + - name: Download x86 Python Package Artifacts + uses: actions/download-artifact@v4 + with: + name: Python Wheel x86_64 + path: dist + + - name: Download arm64 Python Package Artifacts + uses: actions/download-artifact@v4 + with: + name: Python Wheel aarch64 + path: dist + + - name: List dist directory + run: ls -la dist/ + + - name: Publish distribution to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + verbose: true + print-hash: true + skip-existing: true + verify-metadata: true diff --git a/.github/workflows/package-action.yml b/.github/workflows/package-action.yml index da1d3ce..2637427 100644 --- a/.github/workflows/package-action.yml +++ b/.github/workflows/package-action.yml @@ -23,6 +23,26 @@ on: value: "${{ jobs.build.outputs.version }}" jobs: + build-source: + name: Build Python Source Tarball + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - name: Install build + run: | + python -m pip install --upgrade pip + python -m pip install build + - name: Build Source Tarball + run: | + python3 -m build -s + + - name: Python Build Artifact + uses: actions/upload-artifact@v4 + with: + name: Source Tarball + path: dist/* + retention-days: 5 + build: name: Build Python Wheel strategy: @@ -78,11 +98,11 @@ jobs: ${{ inputs.cmd }} - name: Python Build Artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() with: - name: dist-${{ matrix.host }} - path: dist/* + name: Python Wheel ${{ matrix.host }} + path: dist/*.whl retention-days: 5 - name: Read Version