Skip to content

Publish

Publish #22

name: Publish
on:
workflow_run:
workflows: Tests
branches: main
types: completed
workflow_dispatch:
jobs:
build-and-release:
if: "contains(github.event.head_commit.message, 'Version')"
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install setuptools wheel build
python -m pip install Pyinstaller
python setup.py install
- name: Build package
run: python -m build --no-isolation
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Build Windows executables
run: |
pyinstaller -F -i NONE evbunpack/__main__.py --name evbunpack
- name : Get Version
id : get_version
run : |
$message = "${{ github.event.head_commit.message }}"
$lines = $message.Split([Environment]::NewLine)
$version = $lines[0].Split()[1]
Write-Output "::set-output name=version::$version"
- name: Create Release
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]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/evbunpack.exe
asset_name: evbunpack.exe
asset_content_type: application/application/vnd.microsoft.portable-executable
- uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ steps.create_release.outputs.id }}