Skip to content

Commit

Permalink
make prerelease embed look prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
jaylikesbunda committed Dec 22, 2024
1 parent 7f77be7 commit 4fb221d
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 4 deletions.
45 changes: 41 additions & 4 deletions .github/workflows/compile_prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # This ensures we have all commit history

- name: Download All Artifacts
uses: actions/download-artifact@v3
with:
Expand Down Expand Up @@ -200,19 +205,51 @@ jobs:
fi
done
- name: Get Commit History
id: get_commits
run: |
# Get the hash of the last prerelease
last_release=$(curl -s \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/releases" | \
jq -r '[.[] | select(.prerelease == true)] | .[0].target_commitish')
# Get commit messages since last release
if [ ! -z "$last_release" ]; then
commits=$(git log --pretty=format:"- %s" $last_release..HEAD)
else
commits=$(git log --pretty=format:"- %s" -n 10)
fi
# Escape newlines and quotes for JSON
commits="${commits//'%'/'%25'}"
commits="${commits//$'\n'/'\\n'}"
commits="${commits//$'\r'/'%0D'}"
commits="${commits//'"'/'\"'}"
echo "commits=$commits" >> $GITHUB_OUTPUT
- name: Notify Discord of Successful Upload
if: success()
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
run: |
# Get current date in different formats
BUILD_DATE=$(date -u +"%Y-%m-%d")
BUILD_VERSION=$(date -u +"%Y%m%d")
payload=$(cat <<EOF
{
"embeds": [
{
"title": "🎉 New Build Artifacts Uploaded!",
"description": "All build artifacts have been successfully uploaded to Cloudflare R2 and GitHub Release.",
"color": 5814783,
"timestamp": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
"title": "🚀 GhostESP Prerelease Build - $BUILD_DATE",
"description": "A new prerelease build has been uploaded to Cloudflare R2 and GitHub Release.\n\n**Version:** Pre-$BUILD_VERSION\n\n**Changes since last prerelease:**\n${{ steps.get_commits.outputs.commits }}\n\n**Flash your device:**\n🔗 [Flash using GhostESP Web Flasher](https://flasher.ghostesp.net)",
"color": 16750848,
"timestamp": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")",
"footer": {
"text": "GhostESP Prerelease Build $BUILD_VERSION"
}
}
]
}
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

### 🐛 Bug Fixes

- Fix BLE Crash on specific devices - @Spooks4576
- Resolve issues with JC3248W535EN devices #116 - @i-am-shodan, @jaylikesbunda

## 1.4.5
Expand Down

0 comments on commit 4fb221d

Please sign in to comment.