mirror of
https://github.com/Deutscher-Tischfussballbund/com_sportsmanager.git
synced 2026-09-11 18:41:50 +00:00
Compare commits
12
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3ac118803c | ||
|
|
ea174cbd69 | ||
|
|
4838b05d5f | ||
|
|
541af8fb7f | ||
|
|
cc92b938be | ||
|
|
4c21d66fbe | ||
|
|
afb89dba6e | ||
|
|
c4d599834a | ||
|
|
4368d837c0 | ||
|
|
19037d0729 | ||
|
|
bfc65d6030 | ||
|
|
7d47b3ed24 |
@@ -0,0 +1,84 @@
|
||||
# Builds the codebase and publishes a rolling dev-preview release (no version bump).
|
||||
# The release uses a fixed tag "dev-preview" so each run replaces the previous one.
|
||||
|
||||
name: Sportsmanager Dev Preview
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
branch:
|
||||
description: 'Branch to build'
|
||||
required: true
|
||||
default: 'sportsmanager2-prod'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ inputs.branch }}
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
- name: Install npm dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Run build script
|
||||
run: npm run release
|
||||
|
||||
- name: Delete existing dev-preview release (if any)
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
REPO: ${{ github.repository }}
|
||||
run: |
|
||||
release_id=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
|
||||
"https://api.github.com/repos/$REPO/releases/tags/dev-preview" \
|
||||
| jq -r '.id // empty')
|
||||
|
||||
if [ -n "$release_id" ]; then
|
||||
curl -s -X DELETE -H "Authorization: token $GITHUB_TOKEN" \
|
||||
"https://api.github.com/repos/$REPO/releases/$release_id"
|
||||
echo "Deleted existing dev-preview release (ID: $release_id)"
|
||||
else
|
||||
echo "No existing dev-preview release found"
|
||||
fi
|
||||
|
||||
- name: Delete existing dev-preview tag (if any)
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
REPO: ${{ github.repository }}
|
||||
run: |
|
||||
status=$(curl -s -o /dev/null -w "%{http_code}" \
|
||||
-H "Authorization: token $GITHUB_TOKEN" \
|
||||
"https://api.github.com/repos/$REPO/git/refs/tags/dev-preview")
|
||||
|
||||
if [ "$status" = "200" ]; then
|
||||
curl -s -X DELETE -H "Authorization: token $GITHUB_TOKEN" \
|
||||
"https://api.github.com/repos/$REPO/git/refs/tags/dev-preview"
|
||||
echo "Deleted existing dev-preview tag"
|
||||
else
|
||||
echo "No existing dev-preview tag found"
|
||||
fi
|
||||
|
||||
- name: Publish dev-preview release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: dev-preview
|
||||
name: "Dev Preview (${{ github.run_number }})"
|
||||
body: |
|
||||
Automated dev preview build from branch `${{ inputs.branch }}`.
|
||||
Commit: ${{ github.sha }}
|
||||
Run: ${{ github.run_number }}
|
||||
|
||||
> This is a temporary preview release and will be replaced on the next run.
|
||||
files: package/packages/com_sportsmanager.zip
|
||||
draft: false
|
||||
prerelease: true
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -19,11 +19,17 @@ require_once JPATH_SITE . '/components/com_sportsmanager/database/init.php';
|
||||
|
||||
/** @noinspection PhpUnused */
|
||||
function mathParserVerteilung($rohpunkte, $platz, $teilnehmer, $multiplikator) {
|
||||
if ($teilnehmer <= 1){
|
||||
return 0;
|
||||
}
|
||||
return max(round($multiplikator * round(((($rohpunkte - 1) * (-log($platz / $teilnehmer) * (1 - ($platz / $teilnehmer)))) / (-log(1 / $teilnehmer) * (1 - (1 / $teilnehmer)))) + 1)), 1);
|
||||
}
|
||||
|
||||
/** @noinspection PhpUnused */
|
||||
function mathParserVerteilungR($rohpunkte, $platz, $teilnehmer, $multiplikator) {
|
||||
if ($teilnehmer <= 1){
|
||||
return 0;
|
||||
}
|
||||
return max(round(((($multiplikator * $rohpunkte - 1) * (-log($platz / $teilnehmer) * (1 - ($platz / $teilnehmer)))) / (-log(1 / $teilnehmer) * (1 - (1 / $teilnehmer)))) + 1), 1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user