Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 0 additions & 93 deletions .github/workflows/binary.yml

This file was deleted.

70 changes: 59 additions & 11 deletions .github/workflows/notifications.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,91 @@
name: Custom Notifications
name: Notifications

on:
schedule:
- cron: '00 17 * * 6' # 5:00 pm UTC every saturday
issues:
types: [opened, edited, deleted, closed]

issue_comment:
types: [created]

workflow_run:
workflows: ["Build Binary"]
workflows: ["Release"]
types: [completed]

pull_request_target:
types: [opened, closed, edited, review_requested]

jobs:
issue-comment-notification:
issue-notification:
if: github.event_name == 'issues' || github.event_name == 'issue_comment'
runs-on: ubuntu-latest
steps:
- name: Notify on Issue or Comment
if: github.actor != 'Tanq16'
run: |
if [ "${{ github.event_name }}" = "issues" ]; then
ACTION="${{ github.event.action }}"
TITLE="${{ github.event.issue.title }}"
URL="${{ github.event.issue.html_url }}"
MESSAGE="Issue ${ACTION}: **${TITLE}**\n${URL}"
else
URL="${{ github.event.issue.html_url }}"
MESSAGE="New comment on issue\n${URL}"
fi

curl -H "Content-Type: application/json" -X POST \
-d "{\"content\": \"*New issue/comment from **${{ github.actor }}***\n${{ github.event.issue.html_url }}\"}" ${{ secrets.DISCORD_WEBHOOK }}
-d "{\"content\": \"*${{ github.repository }}*\n${MESSAGE}\nBy: **${{ github.actor }}**\"}" \
${{ secrets.DISCORD_WEBHOOK }}

build-status-notification:
build-notification:
if: github.event_name == 'workflow_run'
runs-on: ubuntu-latest
steps:
- name: Notify on Build Status
run: |
WORKFLOW="${{ github.event.workflow_run.name }}"
CONCLUSION="${{ github.event.workflow_run.conclusion }}"
URL="${{ github.event.workflow_run.html_url }}"

if [ "$CONCLUSION" = "success" ]; then
EMOJI="✅"
else
EMOJI="❌"
fi

curl -H "Content-Type: application/json" -X POST \
-d "{\"content\": \"*Workflow run for **${{ github.repository }}***\n${{ github.event.workflow_run.name }} - ${{ github.event.workflow_run.conclusion }}\"}" ${{ secrets.DISCORD_WEBHOOK }}
-d "{\"content\": \"${EMOJI} *${{ github.repository }}*\n**${WORKFLOW}** - ${CONCLUSION}\n${URL}\"}" \
${{ secrets.DISCORD_WEBHOOK }}

pull-request-notification:
pr-notification:
if: github.event_name == 'pull_request_target'
runs-on: ubuntu-latest
steps:
- name: Notify on PR related activities
- name: Notify on PR Activity
if: github.actor != 'Tanq16'
run: |
ACTION="${{ github.event.action }}"
TITLE="${{ github.event.pull_request.title }}"
URL="${{ github.event.pull_request.html_url }}"

case "$ACTION" in
opened)
MESSAGE="🆕 New PR: **${TITLE}**"
;;
closed)
if [ "${{ github.event.pull_request.merged }}" = "true" ]; then
MESSAGE="🎉 PR merged: **${TITLE}**"
else
MESSAGE="🚫 PR closed: **${TITLE}**"
fi
;;
review_requested)
MESSAGE="👀 Review requested: **${TITLE}**"
;;
*)
MESSAGE="PR ${ACTION}: **${TITLE}**"
;;
esac

curl -H "Content-Type: application/json" -X POST \
-d "{\"content\": \"*New PR activity from **${{ github.actor }}***\n${{ github.event.pull_request.html_url }}\"}" ${{ secrets.DISCORD_WEBHOOK }}
-d "{\"content\": \"*${{ github.repository }}*\n${MESSAGE}\n${URL}\nBy: **${{ github.actor }}**\"}" \
${{ secrets.DISCORD_WEBHOOK }}
97 changes: 97 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Release

on:
push:
branches: [main]

permissions:
contents: write
packages: write

jobs:
create-release:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
release_created: ${{ steps.create_release.outputs.release_created }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Calculate Version
id: version
run: |
NEW_VERSION=$(make -s version)
echo "New version: $NEW_VERSION"
echo "version=$NEW_VERSION" >> "$GITHUB_OUTPUT"

- name: Create Draft Release
id: create_release
run: |
gh release create "${{ steps.version.outputs.version }}" \
--title "Release ${{ steps.version.outputs.version }}" \
--draft \
--notes "danzo ${{ steps.version.outputs.version }}" \
--target ${{ github.sha }}
echo "release_created=true" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ github.token }}

binaries:
needs: create-release
runs-on: ubuntu-latest
strategy:
matrix:
include:
- os: linux
arch: amd64
- os: linux
arch: arm64
- os: darwin
arch: amd64
- os: darwin
arch: arm64
- os: windows
arch: amd64
steps:
- uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.25'

- name: Build Binary
run: make build-for GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} VERSION=${{ needs.create-release.outputs.version }}

- name: Upload Release Asset
run: |
gh release upload "${{ needs.create-release.outputs.version }}" \
"${{ github.event.repository.name }}-${{ matrix.os }}-${{ matrix.arch }}" \
--clobber
env:
GH_TOKEN: ${{ github.token }}

publish:
needs: [create-release, binaries]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Publish Release
run: gh release edit "${{ needs.create-release.outputs.version }}" --draft=false
env:
GH_TOKEN: ${{ github.token }}

cleanup-on-failure:
needs: [create-release, binaries, publish]
if: failure() && needs.create-release.outputs.release_created == 'true'
runs-on: ubuntu-latest
steps:
- name: Delete Draft Release
run: |
echo "Cleaning up draft release due to workflow failure"
gh release delete "${{ needs.create-release.outputs.version }}" --yes
env:
GH_TOKEN: ${{ github.token }}
33 changes: 33 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
# Binaries
bin/
*.exe
*.dll
*.so
*.dylib
danzo
danzo-*

# Build artifacts
dist/

# IDE
.idea/
.vscode/
*.swp
*.swo

# OS
.DS_Store
Thumbs.db

# Test
*.test
coverage.out

# Environment
.env
.env.local

# Danzo-specific
download.yaml
.danzo-temp
.danzo-token.json
.danzo-resume-state.json
danzo-gdrive.json

.agents
Loading