mirror of
https://github.com/open-webui/computer.git
synced 2026-11-24 22:37:40 -05:00
refac
This commit is contained in:
1 parent
dbb9ea1625
commit
fa0959981a
3 files changed
+71
-164
No files matched your search
@@ -17,52 +17,27 @@ permissions:
|
||||
packages: write
|
||||
|
||||
jobs:
|
||||
detect-version-change:
|
||||
# ── Read version from pyproject.toml (release builds only) ─────────────────
|
||||
read-version:
|
||||
if: github.ref == 'refs/heads/release'
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
version_changed: ${{ steps.check.outputs.changed }}
|
||||
version: ${{ steps.check.outputs.version }}
|
||||
version: ${{ steps.pkg.outputs.version }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 2
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Check for version bump
|
||||
id: check
|
||||
- name: Read version
|
||||
id: pkg
|
||||
run: |
|
||||
CURRENT=$(python3 -c "
|
||||
VERSION=$(python3 -c "
|
||||
import re, pathlib
|
||||
text = pathlib.Path('pyproject.toml').read_text()
|
||||
m = re.search(r'^version\s*=\s*\"([^\"]+)\"', text, re.M)
|
||||
print(m.group(1))
|
||||
")
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
git show HEAD~1:pyproject.toml > /tmp/prev_pyproject.toml 2>/dev/null || true
|
||||
if [ -f /tmp/prev_pyproject.toml ]; then
|
||||
PREVIOUS=$(python3 -c "
|
||||
import re, pathlib
|
||||
text = pathlib.Path('/tmp/prev_pyproject.toml').read_text()
|
||||
m = re.search(r'^version\s*=\s*\"([^\"]+)\"', text, re.M)
|
||||
print(m.group(1) if m else '')
|
||||
")
|
||||
else
|
||||
PREVIOUS=""
|
||||
fi
|
||||
|
||||
echo "current=$CURRENT"
|
||||
echo "previous=$PREVIOUS"
|
||||
|
||||
if [ "$CURRENT" != "$PREVIOUS" ] && [ -n "$CURRENT" ]; then
|
||||
echo "changed=true" >> "$GITHUB_OUTPUT"
|
||||
echo "version=$CURRENT" >> "$GITHUB_OUTPUT"
|
||||
echo "Version changed: $PREVIOUS -> $CURRENT"
|
||||
else
|
||||
echo "changed=false" >> "$GITHUB_OUTPUT"
|
||||
echo "No version change detected"
|
||||
fi
|
||||
|
||||
# ── Dev builds (main branch) ──────────────────────────────────────────────
|
||||
build-dev:
|
||||
if: github.ref == 'refs/heads/main'
|
||||
strategy:
|
||||
@@ -145,9 +120,10 @@ jobs:
|
||||
-t "${{ env.IMAGE }}:dev-${SHORT_SHA}" \
|
||||
$(printf '${{ env.IMAGE }}@sha256:%s ' *)
|
||||
|
||||
# ── Release builds (release branch) ───────────────────────────────────────
|
||||
build-release:
|
||||
needs: detect-version-change
|
||||
if: github.ref == 'refs/heads/release' && needs.detect-version-change.outputs.version_changed == 'true'
|
||||
needs: read-version
|
||||
if: github.ref == 'refs/heads/release'
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -198,8 +174,8 @@ jobs:
|
||||
retention-days: 1
|
||||
|
||||
merge-release:
|
||||
needs: [detect-version-change, build-release]
|
||||
if: github.ref == 'refs/heads/release' && needs.detect-version-change.outputs.version_changed == 'true'
|
||||
needs: [read-version, build-release]
|
||||
if: github.ref == 'refs/heads/release'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Download digests
|
||||
@@ -222,7 +198,7 @@ jobs:
|
||||
- name: Create release multi-arch manifest
|
||||
working-directory: /tmp/digests
|
||||
run: |
|
||||
VERSION="${{ needs.detect-version-change.outputs.version }}"
|
||||
VERSION="${{ needs.read-version.outputs.version }}"
|
||||
MAJOR_MINOR="${VERSION%.*}"
|
||||
docker buildx imagetools create \
|
||||
-t "${{ env.IMAGE }}:latest" \
|
||||
|
||||
Reference in new issue
Block a user