-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
28 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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: | ||
|