Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* export-ignore
122 changes: 47 additions & 75 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@
- 'v*'

jobs:
build-and-publish:
prepare-release:
runs-on: ubuntu-latest
permissions:
id-token: write # Required for PyPI trusted publishing
contents: write # Required for creating releases
outputs:
version: ${{ steps.get_version.outputs.version }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -28,85 +27,58 @@
- name: Determine version
id: get_version
run: |
if [[ "${{ github.event_name }}" == "release" ]]; then
if [[ "${{ github.event_name }}" == "push" && "${{ github.ref_type }}" == "tag" ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
elif [[ "${{ github.event_name }}" == "release" ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
else
VERSION=${{ github.event.inputs.version }}
fi
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Using version: $VERSION"

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'

- name: Install Poetry and dependencies
run: |
pip install poetry
poetry config virtualenvs.create false
poetry lock
poetry install -q #--quiet (-q) : Do not output any message.
publish-pypi:
needs: prepare-release
uses: ./.github/workflows/publish-pypi.yml
with:
version: ${{ needs.prepare-release.outputs.version }}
secrets:
SIMKL_CLIENT_ID: ${{ secrets.SIMKL_CLIENT_ID }}
SIMKL_CLIENT_SECRET: ${{ secrets.SIMKL_CLIENT_SECRET }}
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}

- name: Set version in pyproject.toml
run: poetry version ${{ env.VERSION }}
build-windows:
Comment thread Dismissed
needs: prepare-release
uses: ./.github/workflows/windows-build.yml
with:
version: ${{ needs.prepare-release.outputs.version }}
secrets:
SIMKL_CLIENT_ID: ${{ secrets.SIMKL_CLIENT_ID }}
SIMKL_CLIENT_SECRET: ${{ secrets.SIMKL_CLIENT_SECRET }}

# This step now injects the secrets directly into the credentials.py file
- name: Inject Simkl Credentials into Code
env:
SIMKL_CLIENT_ID: ${{ secrets.SIMKL_CLIENT_ID }}
SIMKL_CLIENT_SECRET: ${{ secrets.SIMKL_CLIENT_SECRET }}
run: |
# Check if secrets are available
if [ -z "$SIMKL_CLIENT_ID" ]; then
echo "::error::SIMKL_CLIENT_ID secret is not set."
exit 1
fi
if [ -z "$SIMKL_CLIENT_SECRET" ]; then
echo "::error::SIMKL_CLIENT_SECRET secret is not set."
exit 1
fi
build-macos:
Comment thread Dismissed
needs: prepare-release
uses: ./.github/workflows/macos-build.yml
with:
version: ${{ needs.prepare-release.outputs.version }}
secrets:
SIMKL_CLIENT_ID: ${{ secrets.SIMKL_CLIENT_ID }}
SIMKL_CLIENT_SECRET: ${{ secrets.SIMKL_CLIENT_SECRET }}

# Inject Client ID
echo "Injecting SIMKL_CLIENT_ID into credentials.py"
# Use a different delimiter for sed in case the secret contains slashes
sed -i "s|SIMKL_CLIENT_ID_PLACEHOLDER|${SIMKL_CLIENT_ID}|g" simkl_mps/credentials.py
build-linux:
Comment thread Dismissed
needs: prepare-release
uses: ./.github/workflows/linux-build.yml
with:
version: ${{ needs.prepare-release.outputs.version }}
secrets:
SIMKL_CLIENT_ID: ${{ secrets.SIMKL_CLIENT_ID }}
SIMKL_CLIENT_SECRET: ${{ secrets.SIMKL_CLIENT_SECRET }}

# Inject Client Secret
echo "Injecting SIMKL_CLIENT_SECRET into credentials.py"
sed -i "s|SIMKL_CLIENT_SECRET_PLACEHOLDER|${SIMKL_CLIENT_SECRET}|g" simkl_mps/credentials.py

echo "✅ Credentials successfully injected into simkl_mps/credentials.py"

- name: Build and publish
run: |
poetry build
poetry publish
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
VERSION: ${{ env.VERSION }}

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
retention-days: 3

- name: Create and Upload Release
id: create_release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.VERSION }}
name: Release ${{ env.VERSION }}
body: |
![GitHub Downloads (specific asset, specific tag)](https://img.shields.io/github/downloads/${{ github.repository }}/${{ env.VERSION }}/dist)
append_body: true
generate_release_notes: true
files: |
dist/*.whl
make_latest: true
env:
VERSION: ${{ env.VERSION }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
create-github-release:
Comment thread Dismissed
needs: [prepare-release, publish-pypi, build-windows, build-macos, build-linux]
uses: ./.github/workflows/create-release.yml
with:
version: ${{ needs.prepare-release.outputs.version }}
secrets:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Comment thread Dismissed
65 changes: 65 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Create GitHub Release

on:
workflow_call:
inputs:
version:
required: true
type: string
secrets:
GITHUB_TOKEN:
required: true

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: release-artifacts

- name: List downloaded artifacts
run: find release-artifacts -type f | sort

- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ inputs.version }}
name: Release ${{ inputs.version }}
body: |
# MPSS Release ${{ inputs.version }}

## Downloads

### Windows
- [MPSS_Setup_${{ inputs.version }}.exe](https://github.com/${{ github.repository }}/releases/download/v${{ inputs.version }}/MPSS_Setup_${{ inputs.version }}.exe)

### macOS
- [MPSS_macOS.dmg](https://github.com/${{ github.repository }}/releases/download/v${{ inputs.version }}/MPSS_macOS.dmg) (Drag-and-drop installer)
- [MPSS_${{ inputs.version }}.pkg](https://github.com/${{ github.repository }}/releases/download/v${{ inputs.version }}/MPSS_${{ inputs.version }}.pkg) (Package installer)

### Linux
- [MPSS_${{ inputs.version }}.AppImage](https://github.com/${{ github.repository }}/releases/download/v${{ inputs.version }}/MPSS_${{ inputs.version }}.AppImage) (Universal AppImage - runs on most distros)
- [MPSS_${{ inputs.version }}_amd64.deb](https://github.com/${{ github.repository }}/releases/download/v${{ inputs.version }}/MPSS_${{ inputs.version }}_amd64.deb) (Debian/Ubuntu package)

![GitHub Downloads](https://img.shields.io/github/downloads/${{ github.repository }}/v${{ inputs.version }}/total)
generate_release_notes: true
files: |
release-artifacts/windows-installer/*.exe
release-artifacts/macos-installers/*.dmg
release-artifacts/macos-installers/*.pkg
release-artifacts/linux-installers/*.AppImage
release-artifacts/linux-installers/*.deb
draft: false
prerelease: false
make_latest: true
discussion_category_name: "Releases"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading
Loading