Skip to content

Commit

Permalink
Upload release artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
dwoz committed Sep 7, 2024
1 parent b48efa0 commit 01d21dc
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 21 deletions.
29 changes: 12 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ jobs:
with:
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}


test:
name: Test
needs:
Expand All @@ -72,37 +71,33 @@ jobs:
kind: "${{ inputs.kind }}"
cmd: "${{ inputs.package_command }}"

test-python-package:
name: Test Python Package
needs:
- get-changed-files
uses: ./.github/workflows/test-package-action.yml
with:
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}

deploy-python-package:
name: Deploy Python Package
uses: ./.github/workflows/deploy-package-action.yml
if: ${{ inputs.kind == 'release' && success() }}
needs:
- pre-commit
- test
- test-python-package
- build-python-package

create-release:
name: Create Github Release
runs-on: ubuntu-latest
permissions:
contents: write
uses: ./.github/workflows/github-release.yml
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: "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
with:
version: ${{ needs.build-python-package.outputs.version }}

set-pipeline-exit-status:
# This step is just so we can make github require this step, to pass checks
Expand Down
77 changes: 77 additions & 0 deletions .github/workflows/github-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Create Github Release

on:
workflow_call:
inputs:
version:
required: true
type: string

jobs:
release:
name: Publish Python Wheel
runs-on: ubuntu-latest
steps:
- 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: 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: "v${{ inputs.version }}"
release_name: "Release v${{ inputs.version }}"
body: |
Release ${{ needs.build-python-package.outputs.version }}
draft: false
prerelease: false

- name: Upload Source Tarball
id: upload-release-asset-source
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: dist/ppbt-${{ inputs.version }}.tar.gz
asset_name: ppbt-${{ inputs.version }}.tar.gz
asset_content_type: application/tar+gzip

- name: Upload x86-64 Wheel
id: upload-release-asset-x86_64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: dist/ppbt-${{ inputs.version }}-py3-none-manylinux_2_17_x86_64.whl
asset_name: ppbt-${{ inputs.version }}-py3-none-manylinux_2_17_x86_64.whl
asset_content_type: application/zip

- name: Upload arm64 Wheel
id: upload-release-asset-aarch64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: dist/ppbt-${{ inputs.version }}-py3-none-manylinux_2_17_aarch64.whl
asset_name: ppbt-${{ inputs.version }}-py3-none-manylinux_2_17_aarch64.whl
asset_content_type: application/zip
3 changes: 0 additions & 3 deletions .github/workflows/package-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@ jobs:
run: >-
pip install build wheel setuptools pkginfo
- name: Echo Build Wheel Command
run: echo "${{ inputs.cmd }}"

- name: Build Wheel
run: |
${{ inputs.cmd }}
Expand Down
2 changes: 1 addition & 1 deletion src/ppbt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"""
from .common import environ, extract

__version__ = "0.1.5"
__version__ = "0.1.6"

ALL = ("environ", "extract")

0 comments on commit 01d21dc

Please sign in to comment.