Add automatic Nicotine+ version checking and building
- Workflow checks PyPI hourly for new Nicotine+ versions - Automatically builds and pushes new images when updates are available - Creates Gitea releases tagged with Nicotine+ version - Supports manual trigger and push events 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -5,9 +5,44 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 * * * *' # Every hour
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
check-version:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
should_build: ${{ steps.compare.outputs.should_build }}
|
||||||
|
latest_version: ${{ steps.get_version.outputs.version }}
|
||||||
|
steps:
|
||||||
|
- name: Get latest Nicotine+ version from PyPI
|
||||||
|
id: get_version
|
||||||
|
run: |
|
||||||
|
VERSION=$(curl -s https://pypi.org/pypi/nicotine-plus/json | jq -r '.info.version')
|
||||||
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||||
|
echo "Latest Nicotine+ version: $VERSION"
|
||||||
|
|
||||||
|
- name: Get current built version
|
||||||
|
id: current_version
|
||||||
|
run: |
|
||||||
|
CURRENT=$(curl -s https://git.nicola.sh/api/v1/repos/public/nicotine-less/releases/latest 2>/dev/null | jq -r '.tag_name // "none"')
|
||||||
|
echo "current=$CURRENT" >> $GITHUB_OUTPUT
|
||||||
|
echo "Current built version: $CURRENT"
|
||||||
|
|
||||||
|
- name: Compare versions
|
||||||
|
id: compare
|
||||||
|
run: |
|
||||||
|
if [ "${{ steps.get_version.outputs.version }}" != "${{ steps.current_version.outputs.current }}" ]; then
|
||||||
|
echo "should_build=true" >> $GITHUB_OUTPUT
|
||||||
|
echo "New version detected, will build"
|
||||||
|
else
|
||||||
|
echo "should_build=false" >> $GITHUB_OUTPUT
|
||||||
|
echo "Already up to date"
|
||||||
|
fi
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
needs: check-version
|
||||||
|
if: needs.check-version.outputs.should_build == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
@@ -31,6 +66,18 @@ jobs:
|
|||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: |
|
||||||
git.nicola.sh/public/nicotine-less:latest
|
git.nicola.sh/public/nicotine-less:latest
|
||||||
git.nicola.sh/public/nicotine-less:${{ github.sha }}
|
git.nicola.sh/public/nicotine-less:${{ needs.check-version.outputs.latest_version }}
|
||||||
cache-from: type=registry,ref=git.nicola.sh/public/nicotine-less:buildcache
|
cache-from: type=registry,ref=git.nicola.sh/public/nicotine-less:buildcache
|
||||||
cache-to: type=registry,ref=git.nicola.sh/public/nicotine-less:buildcache,mode=max
|
cache-to: type=registry,ref=git.nicola.sh/public/nicotine-less:buildcache,mode=max
|
||||||
|
|
||||||
|
- name: Create release
|
||||||
|
if: needs.check-version.outputs.should_build == 'true'
|
||||||
|
run: |
|
||||||
|
curl -X POST "https://git.nicola.sh/api/v1/repos/public/nicotine-less/releases" \
|
||||||
|
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{
|
||||||
|
\"tag_name\": \"${{ needs.check-version.outputs.latest_version }}\",
|
||||||
|
\"name\": \"Nicotine+ ${{ needs.check-version.outputs.latest_version }}\",
|
||||||
|
\"body\": \"Automated build with Nicotine+ version ${{ needs.check-version.outputs.latest_version }}\"
|
||||||
|
}"
|
||||||
|
|||||||
18
README.md
18
README.md
@@ -95,7 +95,16 @@ docker exec -it nicotine-less nicotine
|
|||||||
|
|
||||||
## Updates
|
## Updates
|
||||||
|
|
||||||
To update Nicotine+ to the latest version, rebuild the container:
|
**Automatic updates**: The container image is automatically rebuilt every hour when a new Nicotine+ version is released on PyPI.
|
||||||
|
|
||||||
|
To update to the latest version, pull the new image:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose pull
|
||||||
|
docker compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
Or rebuild locally:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker compose down
|
docker compose down
|
||||||
@@ -103,13 +112,6 @@ docker compose build --no-cache
|
|||||||
docker compose up -d
|
docker compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
Or pull the pre-built image from the registry:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker compose pull
|
|
||||||
docker compose up -d
|
|
||||||
```
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
This project is provided "as-is" without warranties.
|
This project is provided "as-is" without warranties.
|
||||||
|
|||||||
Reference in New Issue
Block a user