Skip to content

Commit

Permalink
Merge pull request #6 from dwoz/release-workflows
Browse files Browse the repository at this point in the history
Update workflows to prepare for release
  • Loading branch information
dwoz authored Sep 7, 2024
2 parents 99eb947 + 1fd0554 commit b67bfaa
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 29 deletions.
27 changes: 15 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -122,7 +125,7 @@ jobs:
- pre-commit
- test
- deploy-python-package
- push-tag
- create-release
steps:
- name: Get workflow information
id: get-workflow-info
Expand Down
43 changes: 29 additions & 14 deletions .github/workflows/deploy-package-action.yml
Original file line number Diff line number Diff line change
@@ -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
26 changes: 23 additions & 3 deletions .github/workflows/package-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b67bfaa

Please sign in to comment.