Skip to content

Commit

Permalink
feat: add endstone cd
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-vincent committed Dec 20, 2023
1 parent 6898470 commit 13f1a32
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 1 deletion.
93 changes: 93 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Endstone CD

on:
push:
branches:
- next
tags:
- '*'
workflow_dispatch:

jobs:
build_wheels:
name: Build wheel for ${{ matrix.python }}-${{ matrix.machine.platform }} on ${{ matrix.machine.os }}
strategy:
fail-fast: false
matrix:
machine:
- { os: 'windows-latest', platform: 'win_amd64' }
- { os: 'ubuntu-latest', platform: 'manylinux_x86_64' }
python: [ "cp39", "cp310", "cp311", "cp312" ]
runs-on: ${{ matrix.machine.os }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: ilammy/msvc-dev-cmd@v1
with:
toolset: 14.36
vsversion: 2022

- name: Get latest CMake and Ninja
uses: lukka/get-cmake@latest

- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.machine.platform }}

- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: endstone_${{ matrix.python }}-${{ matrix.machine.platform }}.whl
path: ./wheelhouse/*.whl

- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: artifact
path: ./wheelhouse/*.whl


build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Build sdist
run: pipx run build --sdist

- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: artifact
path: dist/*.tar.gz

publish:
name: Publish
if: contains(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: [ build_wheels, build_sdist ]
environment: pypi
permissions:
id-token: write
contents: write

steps:
- name: Restore artifacts
uses: actions/download-artifact@v3
with:
name: artifact
path: dist

- name: Release
uses: softprops/action-gh-release@v1
with:
files: dist/*

- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
2 changes: 2 additions & 0 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ jobs:
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up GCC
uses: egor-tensin/setup-gcc@v1
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v4
Expand Down
2 changes: 1 addition & 1 deletion endstone_python/python/endstone/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from packaging.version import Version

from _version import __version__, __version_tuple__
from ._version import __version__, __version_tuple__

__minecraft__version__ = (lambda v: f"{v[0]}.{v[1]}.{v[2]}.{v[3]:02}")([int(a) for a in Version(__version__).release])

Expand Down

0 comments on commit 13f1a32

Please sign in to comment.