ci: delegate release tagging and versioning to release.yml

This commit is contained in:
2026-04-12 04:21:28 -04:00
parent cb4bac4b42
commit 2ce3f7ee90
2 changed files with 33 additions and 21 deletions

View File

@@ -148,7 +148,7 @@ jobs:
run: | run: |
git fetch origin main git fetch origin main
git checkout main git checkout main
git merge ${{ github.ref }} --no-ff -m "ci: auto-merge testing → main [skip ci]" git merge ${{ github.ref }} --no-ff -m "ci: auto-merge testing → main"
git push origin main git push origin main
echo "--- Cleaning up temp branch ---" echo "--- Cleaning up temp branch ---"
git push origin --delete ${{ github.ref_name }} git push origin --delete ${{ github.ref_name }}

View File

@@ -22,27 +22,38 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
token: ${{ secrets.DECNET_PR_TOKEN }}
- name: Extract version from pyproject.toml - name: Configure git
run: |
git config user.name "DECNET CI"
git config user.email "ci@decnet.local"
- name: Bump version and Tag
id: version id: version
run: | run: |
VERSION=$(python3 -c "import tomllib; f=open('pyproject.toml','rb'); d=tomllib.load(f); print(d['project']['version'])") # Calculate next version (v0.x)
echo "version=$VERSION" >> $GITHUB_OUTPUT LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0")
NEXT_VER=$(python3 -c "
tag = '$LATEST_TAG'.lstrip('v')
parts = tag.split('.')
major = int(parts[0]) if parts[0] else 0
minor = int(parts[1]) if len(parts) > 1 else 0
print(f'{major}.{minor + 1}')
")
- name: Create tag if not exists echo "Next version: $NEXT_VER (calculated from $LATEST_TAG)"
id: tag
run: | # Update pyproject.toml
VERSION=${{ steps.version.outputs.version }} sed -i "s/^version = \".*\"/version = \"$NEXT_VER\"/" pyproject.toml
if git rev-parse "v$VERSION" >/dev/null 2>&1; then
echo "Tag v$VERSION already exists, skipping." git add pyproject.toml
echo "created=false" >> $GITHUB_OUTPUT git commit -m "chore: auto-release v$NEXT_VER [skip ci]" || echo "No changes to commit"
else git tag -a "v$NEXT_VER" -m "Auto-release v$NEXT_VER"
git config user.name "gitea-actions" git push origin main --follow-tags
git config user.email "actions@git.resacachile.cl"
git tag -a "v$VERSION" -m "Release v$VERSION" echo "version=$NEXT_VER" >> $GITHUB_OUTPUT
git push origin "v$VERSION"
echo "created=true" >> $GITHUB_OUTPUT echo "created=true" >> $GITHUB_OUTPUT
fi
docker: docker:
name: Build, scan & push ${{ matrix.service }} name: Build, scan & push ${{ matrix.service }}
@@ -52,7 +63,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
service: service:
- cowrie - conpot
- docker_api - docker_api
- elasticsearch - elasticsearch
- ftp - ftp
@@ -69,11 +80,12 @@ jobs:
- postgres - postgres
- rdp - rdp
- redis - redis
- real_ssh
- sip - sip
- smb - smb
- smtp - smtp
- snmp - snmp
- ssh
- telnet
- tftp - tftp
- vnc - vnc
steps: steps: