Skip to content

Commit

Permalink
Fix actions (cont'd)
Browse files Browse the repository at this point in the history
  • Loading branch information
mos9527 committed Dec 10, 2024
1 parent c03dd6e commit 85785b6
Showing 1 changed file with 28 additions and 21 deletions.
49 changes: 28 additions & 21 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,20 @@ on:
types: completed
workflow_dispatch:
inputs:
version:
description: 'Version'
release_pypi:
description: 'Create a new PyPI release'
type: boolean
required: true
default: '0.0.0'
default: true
release_github:
description: 'Create a new GitHub release'
type: boolean
required: true
default: true

jobs:
build-and-release:
if: "contains(github.event.workflow_run.head_commit.message, 'Version') || github.event.inputs.version"
if: contains(github.event.workflow_run.head_commit.message, 'Version') || github.event.inputs.release_pypi || github.event.inputs.release_github
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -29,51 +35,52 @@ jobs:
python -m pip install Pyinstaller
python -m pip install -e .
python setup.py install
- name: Build package
- name: Build package (PyPI)
if: github.event.inputs.release_pypi
run: python -m build --no-isolation
- name: Publish package
- name: Publish package (PyPI)
if: github.event.inputs.release_pypi
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
twine upload ./dist/*.whl --skip-existing
twine upload ./dist/*.tar.gz --skip-existing
- name: Build Windows executables
- name: Build Windows executable (GitHub)
if: github.event.inputs.release_github
run: |
pyinstaller sssekai.spec
- name : Get Version
if : contains(github.event.workflow_run.head_commit.message, 'Version')
- name : Get Version (GitHub)
if: github.event.inputs.release_github
id : get_version
run : |
$message = @(git log -1 --oneline --format=%s)
$message = @(pip show sssekai)
$lines = $message.Split(' ')
$version = $lines[1]
$version = $lines[3]
Write-Output "::set-output name=version::$version"
- name : Get Version (manual)
if : github.event.inputs.version
id : get_version_input
run : |
$version = ${{ github.event.inputs.version }}
Write-Output "::set-output name=version::$version"
- name: Create Release
- name: Create Release (GitHub)
if: github.event.inputs.release_github
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_version.outputs.version }}
release_name: Version ${{ steps.get_version.outputs.version }}
- uses: actions/[email protected]
- name: Upload Release Asset (GitHub)
if: github.event.inputs.release_github
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/sssekai.exe
asset_name: sssekai.exe
asset_content_type: application/application/vnd.microsoft.portable-executable
- uses: eregon/publish-release@v1
- name: Publish Release (GitHub)
if: github.event.inputs.release_github
uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down

0 comments on commit 85785b6

Please sign in to comment.