mirror of
https://github.com/Deutscher-Tischfussballbund/com_sportsmanager.git
synced 2026-09-11 18:41:50 +00:00
85 lines
2.7 KiB
Plaintext
85 lines
2.7 KiB
Plaintext
# 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 }}
|