Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build for x86 macOS #312

Merged
merged 11 commits into from
Nov 12, 2024
86 changes: 75 additions & 11 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,25 @@ jobs:
name: Build pyinstaller binary
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version:
- '3.12'
os:
- ubuntu-latest
- windows-latest
- macos-13 # only non-large x86 macOS runner image available
- macos-latest
include:
- os: ubuntu-latest
platform: linux-x86_64
container: redhat/ubi8:latest
- os: windows-latest
platform: win-x86_64
- os: macos-13
platform: macos-x86_64
- os: macos-latest
platform: macos-arm64
python-version:
- '3.12'
runs-on: ${{ matrix.os }}
container:
image: ${{ matrix.container }}
container: ${{ matrix.container }}

steps:
- name: Install RHEL 8 dependencies
Expand All @@ -77,14 +87,27 @@ jobs:
uv pip install tox-uv tox-gh-actions
uv run tox

- name: Rename binary
- name: Set platform binary names
shell: bash
run: |
mv dist/mreg-cli${{ contains(matrix.os, 'windows') && '.exe' || '' }} dist/mreg-cli-${{ matrix.os }}-${{ matrix.python-version }}${{ contains(matrix.os, 'windows') && '.exe' || '' }}
VERSION="${{ github.ref_name }}"
BASE_NAME="mreg-cli-${VERSION}-${{ matrix.platform }}"
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
echo "BINARY_NAME=${BASE_NAME}.exe" >> $GITHUB_ENV
echo "SOURCE_NAME=dist/mreg-cli.exe" >> $GITHUB_ENV
else
echo "BINARY_NAME=${BASE_NAME}" >> $GITHUB_ENV
echo "SOURCE_NAME=dist/mreg-cli" >> $GITHUB_ENV
fi

- name: Rename binary
shell: bash
run: mv "${{ env.SOURCE_NAME }}" "dist/${{ env.BINARY_NAME }}"

- uses: actions/upload-artifact@v4
with:
name: mreg-cli-${{ matrix.os }}-${{ matrix.python-version }}${{ contains(matrix.os, 'windows') && '.exe' || '' }}
path: dist/mreg-cli-${{ matrix.os }}-${{ matrix.python-version }}${{ contains(matrix.os, 'windows') && '.exe' || '' }}
name: ${{ env.BINARY_NAME }}
path: dist/${{ env.BINARY_NAME }}
if-no-files-found: error

publish_pypi:
Expand Down Expand Up @@ -125,12 +148,53 @@ jobs:
path: dist
merge-multiple: true

- name: Generate SHA256 checksums
id: sha
run: |
cd dist
echo "checksums<<EOF" >> $GITHUB_OUTPUT
sha256sum * >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
files: dist/*
body: |
Release ${{ github.ref_name }}

## Binary Downloads

Platform | Architecture | Download
---------|--------------|----------
Linux | x86_64 | [mreg-cli-${{ github.ref_name }}-linux-x86_64](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/mreg-cli-${{ github.ref_name }}-linux-x86_64)
Windows | x86_64 | [mreg-cli-${{ github.ref_name }}-win-x86_64.exe](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/mreg-cli-${{ github.ref_name }}-win-x86_64.exe)
macOS | x86_64 | [mreg-cli-${{ github.ref_name }}-macos-x86_64](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/mreg-cli-${{ github.ref_name }}-macos-x86_64)
macOS | ARM64 | [mreg-cli-${{ github.ref_name }}-macos-arm64](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/mreg-cli-${{ github.ref_name }}-macos-arm64)

## PyPI Package

### uv

```bash
uv tool install mreg-cli==${{ github.ref_name }}
```

### pipx

```bash
pipx install mreg-cli==${{ github.ref_name }}
```

### pip

```bash
pip install mreg-cli==${{ github.ref_name }}
```

## SHA256 Checksums
```
${{ steps.sha.outputs.checksums }}
```
draft: false
prerelease: false

prerelease: false