Build Release #57
Workflow file for this run
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
name: Build Release | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build ${{ matrix.target }} | |
continue-on-error: ${{ matrix.experimental == 1 }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- runs-on: macos-13 | |
target: x86_64-apple-darwin | |
- runs-on: macos-13 | |
target: aarch64-apple-darwin | |
- runs-on: windows-latest | |
target: x86_64-pc-windows-msvc | |
- runs-on: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
- runs-on: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
- runs-on: ubuntu-latest | |
target: aarch64-unknown-linux-musl | |
runs-on: ${{ matrix.runs-on }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
architecture: x64 | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
args: --profile release-lto --out dist -m Cargo.toml | |
manylinux: auto | |
- name: Build wheels (musl) | |
if: contains(matrix.target, 'musl') | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
args: --profile release-lto --out dist -m Cargo.toml | |
manylinux: musllinux_1_2 | |
- name: Install built wheel | |
if: "startsWith(matrix.target, 'x86_64')" | |
run: | | |
pip install gvmkit-build --no-index --find-links dist --force-reinstall | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: dist | |
- name: "Archive binary" | |
if: "matrix.runs-on == 'ubuntu-latest'" | |
run: | | |
ARCHIVE_FILE=gvmkit-build-${{ matrix.target }}.tar.gz | |
tar czvf $ARCHIVE_FILE -C target/${{ matrix.target }}/release-lto gvmkit-build | |
shasum -a 256 $ARCHIVE_FILE > $ARCHIVE_FILE.sha256 | |
- name: "Archive binary" | |
if: "matrix.runs-on == 'macos-13'" | |
run: | | |
ARCHIVE_FILE=gvmkit-build-${{ matrix.target }}.tar.gz | |
gtar --format=pax -czvf $ARCHIVE_FILE -C target/${{ matrix.target }}/release-lto gvmkit-build | |
shasum -a 256 $ARCHIVE_FILE > $ARCHIVE_FILE.sha256 | |
- name: "Archive binary" | |
shell: bash | |
if: "matrix.runs-on == 'windows-latest'" | |
run: | | |
ARCHIVE_FILE=gvmkit-build-${{ matrix.target }}.zip | |
7z a $ARCHIVE_FILE ./target/${{ matrix.target }}/release-lto/gvmkit-build.exe | |
sha256sum $ARCHIVE_FILE > $ARCHIVE_FILE.sha256 | |
- name: "Upload binary" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: binaries | |
path: | | |
*.tar.gz | |
*.zip | |
*.sha256 | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
if: "startsWith(github.ref, 'refs/tags/')" | |
needs: build | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: wheels | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Publish to PyPI | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
run: | | |
pip install --upgrade twine | |
twine upload --skip-existing * | |
- uses: actions/download-artifact@v3 | |
with: | |
name: binaries | |
path: binaries | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: binaries/* |