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
133 changes: 133 additions & 0 deletions .github/workflows/version-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
name: Auto Version and Release

on:
push:
branches: [ "main" ]
pull_request:
types: [ closed ]
branches: [ "main" ]

jobs:
version-and-release:
if: github.event_name == 'push' || (github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main')
runs-on: ubuntu-latest
permissions:
contents: write
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

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

- name: Get current version
id: current_version
run: |
VERSION=$(python3 -c "from version import get_version; print(get_version())")
echo "current_version=$VERSION" >> $GITHUB_OUTPUT
echo "Current version: $VERSION"

- name: Increment version
id: new_version
run: |
# Get the current version and increment patch number
CURRENT_VERSION="${{ steps.current_version.outputs.current_version }}"
IFS='.' read -ra VERSION_PARTS <<< "$CURRENT_VERSION"
MAJOR=${VERSION_PARTS[0]}
MINOR=${VERSION_PARTS[1]}
PATCH=${VERSION_PARTS[2]}
NEW_PATCH=$((PATCH + 1))
NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH"
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
echo "New version: $NEW_VERSION"

- name: Update version in code
run: |
NEW_VERSION="${{ steps.new_version.outputs.new_version }}"
sed -i "s/__version__ = \".*\"/__version__ = \"$NEW_VERSION\"/" version.py
echo "Updated version.py with version $NEW_VERSION"

- name: Generate changelog
id: changelog
run: |
# Get the latest tag
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
if [ -z "$LATEST_TAG" ]; then
echo "No previous tag found, getting all commits"
COMMITS=$(git log --oneline --pretty=format:"- %s" HEAD)
else
echo "Getting commits since $LATEST_TAG"
COMMITS=$(git log --oneline --pretty=format:"- %s" $LATEST_TAG..HEAD)
fi

# Create changelog
{
echo "## Changes in v${{ steps.new_version.outputs.new_version }}"
echo ""
if [ -n "$COMMITS" ]; then
echo "$COMMITS"
else
echo "- Minor updates and improvements"
fi
} > CHANGELOG.md

# Set output for release notes
{
echo 'changelog<<EOF'
cat CHANGELOG.md
echo EOF
} >> $GITHUB_OUTPUT

- name: Commit version update
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add version.py
git commit -m "Bump version to v${{ steps.new_version.outputs.new_version }}" || echo "No changes to commit"
git push

- name: Create Git Tag
run: |
git tag "v${{ steps.new_version.outputs.new_version }}"
git push origin "v${{ steps.new_version.outputs.new_version }}"

- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
tag: v${{ steps.new_version.outputs.new_version }}
name: Release v${{ steps.new_version.outputs.new_version }}
body: ${{ steps.changelog.outputs.changelog }}
draft: false
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}

- name: Log in to the GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=raw,value=latest
type=raw,value=v${{ steps.new_version.outputs.new_version }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
.DS_Store

# Python
__pycache__/
*.py[cod]
*$py.class
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Dein persönlicher Assistent, der nie schläft! Dieses Tool meldet sich täglich
<img src="https://img.shields.io/github/downloads/cancel-cloud/IdleOutpostClaimer/total?logo=github&style=for-the-badge&label=Forks" alt="GitHub Forks"/>
<img src="https://img.shields.io/github/license/cancel-cloud/IdleOutpostClaimer?style=for-the-badge" alt="License"/>
<img src="https://img.shields.io/github/last-commit/cancel-cloud/IdleOutpostClaimer?style=for-the-badge&logo=github" alt="Last Commit"/>
<img src="https://img.shields.io/github/v/release/cancel-cloud/IdleOutpostClaimer?style=for-the-badge" alt="Latest Release"/>
</div>

---
Expand All @@ -30,6 +31,33 @@ Sind wir ehrlich: Tägliche Anmeldeboni sind super, aber man vergisst sie leicht
- **📦 Docker-isoliert**: Läuft in einem sauberen, abgeschotteten Container. "Set it and forget it!"
- **⚙️ Minimale Konfiguration**: Alles, was du brauchst, ist deine `USER_GAME_ID`.
- **📝 Detailliertes Logging**: Jede Aktion wird protokolliert. Du hast volle Kontrolle und Transparenz.
- **🔄 Automatische Versionierung**: Das System erstellt automatisch neue Releases und aktualisiert Versionsnummern bei jeder Aktualisierung.
- **📊 Versionsverfolgung**: Jeder Log-Eintrag zeigt die aktuelle Version an, sodass du immer weißt, welche Version läuft.

---

## 📋 Versionierung & Releases

Das Projekt verwendet ein automatisches Versionierungssystem:

- **🏷️ Automatische Releases**: Bei jedem Push oder Merge in den `main`-Branch wird automatisch eine neue Version erstellt
- **📈 Patch-Versionierung**: Versionen werden automatisch hochgezählt (z.B. 1.0.4 → 1.0.5 → 1.0.6)
- **📝 Changelog**: Jedes Release enthält eine Liste der Änderungen seit der letzten Version
- **🐳 Docker Tags**: Docker Images werden automatisch mit der aktuellen Versionsnummer getaggt
- **📊 Logs mit Version**: Die Anwendung zeigt die aktuelle Version in allen Log-Ausgaben an

### Aktuelle Version anzeigen

Die aktuelle Version wird beim Start der Anwendung angezeigt:
```
[22.07.25-20:37] 🚀 Idle Outpost Claimer v1.0.4 gestartet.
[22.07.25-20:37] ⚙️ Idle Outpost Claimer v1.0.4 - Führe planmäßigen Claim aus...
```

Du kannst auch die Version direkt abfragen:
```bash
docker exec idle-outpost-claimer python3 -c "from version import get_version; print(f'Version: {get_version()}')"
```

---

Expand Down
5 changes: 3 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from datetime import datetime, timedelta
import sys
from zoneinfo import ZoneInfo, ZoneInfoNotFoundError
from version import get_version


# Basis-URLs
Expand Down Expand Up @@ -103,7 +104,7 @@ def show_startup_message():
hours, remainder = divmod(time_diff.seconds, 3600)
minutes, _ = divmod(remainder, 60)

log("🚀 Idle Outpost Claimer gestartet.")
log(f"🚀 Idle Outpost Claimer v{get_version()} gestartet.")
log(f"Nächster automatischer Claim um {next_run.strftime('%H:%M')}. Das ist in {hours} Stunden und {minutes} Minuten.")


Expand All @@ -129,4 +130,4 @@ def show_startup_message():
claim(sess, 'legendary')
claim(sess, 'weekly')

log("\n🏁 Alle Aktionen abgeschlossen.")
log("\n🏁 Alle Aktionen abgeschlossen.")
31 changes: 31 additions & 0 deletions version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env python3
"""
Version management for IdleOutpostClaimer
"""

# Current version of the application
__version__ = "1.0.4"

def get_version():
"""
Get the current version string

Returns:
str: Current version number
"""
return __version__

def get_version_info():
"""
Get detailed version information

Returns:
dict: Version information including major, minor, and patch numbers
"""
parts = __version__.split('.')
return {
'major': int(parts[0]) if len(parts) > 0 else 0,
'minor': int(parts[1]) if len(parts) > 1 else 0,
'patch': int(parts[2]) if len(parts) > 2 else 0,
'version_string': __version__
}
Loading