feat: add ntfy notifications and semantic versioning (ADR-0015)
Some checks failed
Build and Push Images / build-nvidia (push) Failing after 26s
Build and Push Images / build-strixhalo (push) Failing after 34s
Build and Push Images / build-rdna2 (push) Failing after 47s
Build and Push Images / build-intel (push) Failing after 23s
Build and Push Images / Release (push) Has been skipped
Build and Push Images / Notify (push) Successful in 1s
Some checks failed
Build and Push Images / build-nvidia (push) Failing after 26s
Build and Push Images / build-strixhalo (push) Failing after 34s
Build and Push Images / build-rdna2 (push) Failing after 47s
Build and Push Images / build-intel (push) Failing after 23s
Build and Push Images / Release (push) Has been skipped
Build and Push Images / Notify (push) Successful in 1s
This commit is contained in:
@@ -18,6 +18,7 @@ on:
|
||||
|
||||
env:
|
||||
REGISTRY: git.daviestechlabs.io/daviestechlabs
|
||||
NTFY_URL: http://ntfy.observability.svc.cluster.local:80
|
||||
|
||||
jobs:
|
||||
build-nvidia:
|
||||
@@ -213,3 +214,92 @@ jobs:
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
release:
|
||||
name: Release
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build-nvidia, build-rdna2, build-strixhalo, build-intel]
|
||||
if: gitea.ref == 'refs/heads/main' && gitea.event_name == 'push'
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Determine version bump
|
||||
id: version
|
||||
run: |
|
||||
# Get latest tag or default to v0.0.0
|
||||
LATEST=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
|
||||
VERSION=${LATEST#v}
|
||||
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
|
||||
|
||||
# Check commit message for keywords
|
||||
MSG="${{ gitea.event.head_commit.message }}"
|
||||
if echo "$MSG" | grep -qiE "^major:|BREAKING CHANGE"; then
|
||||
MAJOR=$((MAJOR + 1)); MINOR=0; PATCH=0
|
||||
BUMP="major"
|
||||
elif echo "$MSG" | grep -qiE "^(minor:|feat:)"; then
|
||||
MINOR=$((MINOR + 1)); PATCH=0
|
||||
BUMP="minor"
|
||||
else
|
||||
PATCH=$((PATCH + 1))
|
||||
BUMP="patch"
|
||||
fi
|
||||
|
||||
NEW_VERSION="v${MAJOR}.${MINOR}.${PATCH}"
|
||||
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
|
||||
echo "bump=$BUMP" >> $GITHUB_OUTPUT
|
||||
echo "Bumping $LATEST → $NEW_VERSION ($BUMP)"
|
||||
|
||||
- name: Create and push tag
|
||||
run: |
|
||||
git config user.name "gitea-actions[bot]"
|
||||
git config user.email "actions@git.daviestechlabs.io"
|
||||
git tag -a ${{ steps.version.outputs.version }} -m "Release ${{ steps.version.outputs.version }}"
|
||||
git push origin ${{ steps.version.outputs.version }}
|
||||
|
||||
notify:
|
||||
name: Notify
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build-nvidia, build-rdna2, build-strixhalo, build-intel, release]
|
||||
if: always()
|
||||
steps:
|
||||
- name: Notify on success
|
||||
if: |
|
||||
(needs.build-nvidia.result == 'success' || needs.build-nvidia.result == 'skipped') &&
|
||||
(needs.build-rdna2.result == 'success' || needs.build-rdna2.result == 'skipped') &&
|
||||
(needs.build-strixhalo.result == 'success' || needs.build-strixhalo.result == 'skipped') &&
|
||||
(needs.build-intel.result == 'success' || needs.build-intel.result == 'skipped')
|
||||
run: |
|
||||
curl -s \
|
||||
-H "Title: ✅ Images Built: ${{ gitea.repository }}" \
|
||||
-H "Priority: default" \
|
||||
-H "Tags: white_check_mark,docker" \
|
||||
-H "Click: ${{ gitea.server_url }}/${{ gitea.repository }}/actions/runs/${{ gitea.run_id }}" \
|
||||
-d "Branch: ${{ gitea.ref_name }}
|
||||
nvidia: ${{ needs.build-nvidia.result }}
|
||||
rdna2: ${{ needs.build-rdna2.result }}
|
||||
strixhalo: ${{ needs.build-strixhalo.result }}
|
||||
intel: ${{ needs.build-intel.result }}
|
||||
Release: ${{ needs.release.result == 'success' && 'created' || 'skipped' }}" \
|
||||
${{ env.NTFY_URL }}/gitea-ci
|
||||
|
||||
- name: Notify on failure
|
||||
if: |
|
||||
needs.build-nvidia.result == 'failure' ||
|
||||
needs.build-rdna2.result == 'failure' ||
|
||||
needs.build-strixhalo.result == 'failure' ||
|
||||
needs.build-intel.result == 'failure'
|
||||
run: |
|
||||
curl -s \
|
||||
-H "Title: ❌ Image Build Failed: ${{ gitea.repository }}" \
|
||||
-H "Priority: high" \
|
||||
-H "Tags: x,docker" \
|
||||
-H "Click: ${{ gitea.server_url }}/${{ gitea.repository }}/actions/runs/${{ gitea.run_id }}" \
|
||||
-d "Branch: ${{ gitea.ref_name }}
|
||||
nvidia: ${{ needs.build-nvidia.result }}
|
||||
rdna2: ${{ needs.build-rdna2.result }}
|
||||
strixhalo: ${{ needs.build-strixhalo.result }}
|
||||
intel: ${{ needs.build-intel.result }}" \
|
||||
${{ env.NTFY_URL }}/gitea-ci
|
||||
|
||||
Reference in New Issue
Block a user