on:
release:
types: [published]
+env:
+ PYTHON_VERSION: "3.11"
jobs:
build-and-publish-pypi:
outputs:
version: ${{ steps.vars.outputs.tag }}
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v4.1.4
- name: Get tag
id: vars
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- - name: Set up Python 3.11
+ - name: Validate version number
+ run: >-
+ if [[ "${{ github.event.release.prerelease }}" == "true" ]]; then
+ if ! [[ "${{ steps.vars.outputs.tag }}" =~ "b" ]]; then
+ echo "Pre-release: Tag is missing beta suffix (${{ steps.vars.outputs.tag }})"
+ exit 1
+ fi
+ else
+ if [[ "${{ steps.vars.outputs.tag }}" =~ "b" ]]; then
+ echo "Release: Tag must not have a beta suffix (${{ steps.vars.outputs.tag }})"
+ exit 1
+ fi
+ fi
+ - name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5.1.0
with:
- python-version: "3.11"
+ python-version: ${{ env.PYTHON_VERSION }}
- name: Install build
run: >-
pip install build tomli tomli-w
with open("pyproject.toml", "wb") as f:
tomli_w.dump(pyproject, f)
- - name: Build
+ - name: Build python package
run: >-
python3 -m build
- name: Publish release to PyPI
run: sleep 300
build-and-push-container-image:
- name: Builds and pushes the Music Assistant Server container to ghcr.io
+ name: Builds and pushes the Matter Server container to ghcr.io
runs-on: ubuntu-latest
permissions:
packages: write
needs: build-and-publish-pypi
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v4.1.4
- name: Log in to the GitHub container registry
uses: docker/login-action@v3.1.0
with:
echo "patch=${patch}" >> $GITHUB_OUTPUT
echo "minor=${patch%.*}" >> $GITHUB_OUTPUT
echo "major=${patch%.*.*}" >> $GITHUB_OUTPUT
- if [[ $patch =~ "b" ]]; then
- echo "channel=beta" >> $GITHUB_OUTPUT
- else
- echo "channel=stable" >> $GITHUB_OUTPUT
- fi
-
- - name: Docker meta
- id: meta
- uses: docker/metadata-action@v5
- with:
- images: |
- ghcr.io/${{ github.repository_owner }}/server
-
- - name: Build and Push images
+ - name: Build and Push release
uses: docker/build-push-action@v5.3.0
+ if: github.event.release.prerelease == false
with:
context: .
platforms: linux/amd64,linux/arm64
ghcr.io/${{ github.repository_owner }}/server:${{ steps.tags.outputs.patch }},
ghcr.io/${{ github.repository_owner }}/server:${{ steps.tags.outputs.minor }},
ghcr.io/${{ github.repository_owner }}/server:${{ steps.tags.outputs.major }},
- ghcr.io/${{ github.repository_owner }}/server:${{ steps.tags.outputs.channel }},
- ghcr.io/${{ github.repository_owner }}/server:latest
+ ghcr.io/${{ github.repository_owner }}/server:stable
+ push: true
+ build-args: "MASS_VERSION=${{ needs.build-and-publish-pypi.outputs.version }}"
+ - name: Build and Push pre-release
+ uses: docker/build-push-action@v5.3.0
+ if: github.event.release.prerelease == true
+ with:
+ context: .
+ platforms: linux/amd64,linux/arm64
+ file: Dockerfile
+ tags: |-
+ ghcr.io/${{ github.repository_owner }}/server:${{ steps.tags.outputs.patch }},
+ ghcr.io/${{ github.repository_owner }}/server:beta
push: true
- labels: ${{ steps.meta.outputs.labels }}
- build-args: |
- "MASS_VERSION=${{ needs.build-and-publish-pypi.outputs.version }}"
+ build-args: "MASS_VERSION=${{ needs.build-and-publish-pypi.outputs.version }}"
release-notes-update:
name: Updates the release notes and changelog
- needs: [ build-and-publish-pypi, build-and-push-container-image ]
+ needs: [build-and-publish-pypi, build-and-push-container-image]
runs-on: ubuntu-latest
steps:
- name: Update changelog and release notes including frontend notes
uses: music-assistant/release-notes-merge-action@main
+ if: github.event.release.prerelease == true
with:
github_token: ${{ secrets.PRIVILEGED_GITHUB_TOKEN }}
release_tag: ${{ needs.build-and-publish-pypi.outputs.version }}
addon-version-update:
name: Updates the Addon repository with the new version
- needs: [ build-and-publish-pypi, build-and-push-container-image, release-notes-update ]
+ needs:
+ [
+ build-and-publish-pypi,
+ build-and-push-container-image,
+ release-notes-update,
+ ]
runs-on: ubuntu-latest
steps:
- name: Push new version number to addon config
uses: music-assistant/addon-update-action@main
+ if: github.event.release.prerelease == true
with:
github_token: ${{ secrets.PRIVILEGED_GITHUB_TOKEN }}
new_server_version: ${{ needs.build-and-publish-pypi.outputs.version }}
"sort_name_desc": "sort_name DESC",
"timestamp_added": "timestamp_added ASC",
"timestamp_added_desc": "timestamp_added DESC",
+ "timestamp_modified": "timestamp_modified ASC",
+ "timestamp_modified_desc": "timestamp_modified DESC",
"last_played": "last_played ASC",
"last_played_desc": "last_played DESC",
"play_count": "play_count ASC",
# get (first) provider item id belonging to this library item
add_to_library = True
metadata_lookup = True
- provider_instance_id_or_domain, item_id = await self.get_provider_mapping(library_item)
+ if library_item:
+ # resolve library item into a provider item to get the source details
+ provider_instance_id_or_domain, item_id = await self.get_provider_mapping(
+ library_item
+ )
# grab full details from the provider
details = await self.get_provider_item(