Skip to content

feat: signup bonus offset — subtract promotional credits from balances #71

feat: signup bonus offset — subtract promotional credits from balances

feat: signup bonus offset — subtract promotional credits from balances #71

Workflow file for this run

name: Auto Release
on:
push:
branches: [main]
paths:
- 'Dockerfile'
- 'Dockerfile.worker'
- 'requirements.txt'
- 'requirements-worker.txt'
- 'app/**'
- 'services/**'
- 'docker-compose*.yml'
workflow_dispatch:
permissions:
contents: write
packages: write
jobs:
release:
name: Bump version and release
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"
outputs:
new_tag: ${{ steps.version.outputs.new_tag }}
build_ui: ${{ steps.changes.outputs.ui }}
build_worker: ${{ steps.changes.outputs.worker }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Detect what changed
id: changes
run: |
CHANGED=$(git diff --name-only HEAD~1 HEAD 2>/dev/null || echo "")
echo "Changed files: $CHANGED"
BUILD_UI=false
BUILD_WORKER=false
if echo "$CHANGED" | grep -qE '^(Dockerfile|requirements\.txt|app/(main|database|catalog|auth|compose_generator|exchange_rates|constants|collectors|templates|static))'; then
BUILD_UI=true
fi
if echo "$CHANGED" | grep -qE '^services/'; then
BUILD_UI=true
fi
if echo "$CHANGED" | grep -qE '^(Dockerfile\.worker|requirements-worker\.txt|app/(worker_api|orchestrator|constants)\.py)'; then
BUILD_WORKER=true
fi
if echo "$CHANGED" | grep -qE '^app/__init__\.py'; then
BUILD_UI=true
BUILD_WORKER=true
fi
# Shared constants affect both
if echo "$CHANGED" | grep -qE '^app/constants\.py'; then
BUILD_UI=true
BUILD_WORKER=true
fi
echo "ui=$BUILD_UI" >> "$GITHUB_OUTPUT"
echo "worker=$BUILD_WORKER" >> "$GITHUB_OUTPUT"
echo "Build UI: $BUILD_UI, Build Worker: $BUILD_WORKER"
- name: Get latest version tag
id: version
if: steps.changes.outputs.ui == 'true' || steps.changes.outputs.worker == 'true'
run: |
LATEST=$(git tag -l 'v*.*.*' --sort=-v:refname | head -1)
if [ -z "$LATEST" ]; then
LATEST="v0.0.0"
fi
echo "latest=$LATEST" >> "$GITHUB_OUTPUT"
VERSION="${LATEST#v}"
MAJOR=$(echo "$VERSION" | cut -d. -f1)
MINOR=$(echo "$VERSION" | cut -d. -f2)
PATCH=$(echo "$VERSION" | cut -d. -f3)
NEW_PATCH=$((PATCH + 1))
NEW_TAG="v${MAJOR}.${MINOR}.${NEW_PATCH}"
echo "new_tag=$NEW_TAG" >> "$GITHUB_OUTPUT"
echo "Bumping $LATEST -> $NEW_TAG"
- name: Create and push tag
if: steps.version.outputs.new_tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "${{ steps.version.outputs.new_tag }}" -m "Release ${{ steps.version.outputs.new_tag }}"
git push origin "${{ steps.version.outputs.new_tag }}"
- name: Create GitHub Release
if: steps.version.outputs.new_tag
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.new_tag }}
generate_release_notes: true
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build:
needs: release
if: needs.release.outputs.new_tag
uses: ./.github/workflows/build.yml
with:
build_ui: ${{ needs.release.outputs.build_ui == 'true' }}
build_worker: ${{ needs.release.outputs.build_worker == 'true' }}
version: ${{ needs.release.outputs.new_tag }}
secrets: inherit