Files
thomaskippster-comfymodeldo…/.github/workflows/maven-release.yml
T

87 lines
2.8 KiB
YAML

name: Maven Auto-Release
on:
workflow_dispatch: # Startet weiterhin manuell per Klick, aber ohne Texteingabe
jobs:
release:
runs-on: ubuntu-latest
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
permissions:
contents: write
packages: write
steps:
- name: Checkout Code
uses: actions/checkout@v6
with:
fetch-depth: 0
ref: main
- name: Set up JDK 17
uses: actions/setup-java@v5
with:
java-version: '17'
distribution: 'temurin'
server-id: github
server-username: GITHUB_ACTOR
server-password: GITHUB_TOKEN
- name: Configure Git User
run: |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
- name: Set Version and Build
run: |
# Wir nehmen 1.0 als Basis und hängen die Run-Nummer an
NEW_VERSION="1.0.${{ github.run_number }}"
echo "VERSION=$NEW_VERSION" >> $GITHUB_ENV
# Version in pom.xml patchen
mvn -B versions:set -DnewVersion=$NEW_VERSION -DgenerateBackupPoms=false
# Projekt bauen
mvn -B clean package -DskipTests
- name: Create Git Tag
run: |
git add pom.xml
git commit -m "chore: bump version to ${{ env.VERSION }}"
git tag v${{ env.VERSION }}
git push origin main --tags
- name: Install SSH Key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SF_SSH_KEY }}
known_hosts: unnecessary
if_key_exists: replace
- name: Add SourceForge to Known Hosts
run: |
mkdir -p ~/.ssh
ssh-keyscan -t ed25519 frs.sourceforge.net >> ~/.ssh/known_hosts
- name: Upload to SourceForge
run: |
REL_VERSION="v${{ env.VERSION }}"
PROJECT_NAME="comfymodeldownloader"
echo "Uploading version $REL_VERSION to project $PROJECT_NAME..."
# Wir nutzen sftp, da es in der restricted shell von SourceForge oft zuverlässiger ist als rsync
# und wir damit gezielt das Verzeichnis anlegen können.
# Das Minus vor mkdir ignoriert Fehler, falls das Verzeichnis bereits existiert.
cat <<EOF > sftp_batch
-mkdir /home/frs/project/$PROJECT_NAME/$REL_VERSION
put target/ComfyUIModelDownloader.jar /home/frs/project/$PROJECT_NAME/$REL_VERSION/
quit
EOF
sftp -b sftp_batch -o StrictHostKeyChecking=no thomaskifree@frs.sourceforge.net