1
0
mirror of synced 2024-11-30 15:54:27 +01:00

create-release.yml: Add release workflow

This commit is contained in:
Viv 2023-06-26 19:56:46 -04:00
parent 99331eeeb8
commit 4a2ee1cac0

66
.github/workflows/create_release.yml vendored Normal file
View File

@ -0,0 +1,66 @@
name: "Create release"
on:
workflow_dispatch:
inputs:
release_version:
description: 'Release version number'
required: true
jobs:
create-release:
runs-on: windows-2019
# Only create the release if workflow is run manually. (This allows the other steps in the workflow to test PRs.)
if: github.event_name == 'workflow_dispatch'
steps:
# The GitHub Actions bot email was taken from: https://github.community/t/github-actions-bot-email-address/17204/6
- name: Set bot user data for commits
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Actions Bot"
- name: Checkout tja2fumen (main branch)
uses: actions/checkout@v3
with:
ref: ${{ env.MAIN_BRANCH }}
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.8.x'
- name: Install dependencies
run: pip install toml-cli build twine pyinstaller
- name: Update pyproject.toml version (for release)
run: |
toml set --toml-path pyproject.toml project.version "${{ github.event.inputs.release_version }}"
git add pyproject.toml
git commit -m "Update pyproject.toml version for ${{ github.event.inputs.release_version }}"
- name: Build wheel/sdist
run: python -m build
- name: Build pyinstaller executable
run: |
pyinstaller src\tja2fumen\__init__.py --name tja2fumen-${{ github.event.inputs.release_version }} --add-data="src\tja2fumen\soulgauge_LUTs\*.csv;tja2fumen\soulgauge_LUTs" --onefile
- name: Push release changes
run: |
git tag ${{ github.event.inputs.release_version }}
git push --tags
- uses: ncipollo/release-action@v1
name: Create release
id: create_release
with:
tag: ${{ github.event.inputs.release_version }}
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "dist/tja2fumen-${{ github.event.inputs.release_version }}.exe,\
dist/tja2fumen-${{ github.event.inputs.release_version }}.tar.gz,\
dist/tja2fumen-${{ github.event.inputs.release_version }}-py3-none-any.whl"
draft: true
- name: Publish distribution to PyPI
run: twine upload dist/*.whl dist/*.tar.gz --username __token__ --password ${{ secrets.PYPI_API_TOKEN }}