Skip to content

Commit

Permalink
Merge pull request #4 from dwoz/release-workflow
Browse files Browse the repository at this point in the history
Use trusted publisher from pypi
  • Loading branch information
dwoz authored Sep 6, 2024
2 parents 72bbefa + 09de180 commit 751d5e9
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 12 deletions.
26 changes: 24 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ jobs:
- pre-commit
with:
kind: "${{ inputs.kind }}"
cmd: python -m build
#cmd: "${{ inputs.package_command }}"
cmd: "${{ inputs.package_command }}"

test:
name: Test
Expand Down Expand Up @@ -112,6 +111,29 @@ jobs:
tag: "v${{ needs.build-python-package.outputs.version }}"
message: "Version ${{ needs.build-python-package.outputs.version }}"

create-release:
name: Push Version Tag
runs-on: ubuntu-latest
permissions:
contents: write
if: ${{ inputs.kind == 'release' && success() }}
needs:
- build-python-package
- deploy-python-package
steps:
- 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_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
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
# on a pull request instead of requiring all
Expand Down
28 changes: 18 additions & 10 deletions .github/workflows/deploy-package-action.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Relenv Python Package
name: ppbt Python Package

on:
workflow_call:
Expand All @@ -11,12 +11,20 @@ jobs:
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 x86 Python Package Artifacts
uses: actions/download-artifact@v3
with:
name: dist-x86_64
path: dist

- name: Download arm64 Python Package Artifacts
uses: actions/download-artifact@v3
with:
name: dist-aarch64
path: dist

- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
name: Create Release
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ on:
jobs:
ci:
name: CI
environment: release
permissions:
contents: write
pull-requests: read
id-token: write
uses: ./.github/workflows/ci.yml
if: contains('["dwoz", "twangboy", "dmurphy18"]', github.actor)
with:
Expand Down

0 comments on commit 751d5e9

Please sign in to comment.