|
@@ -4,6 +4,12 @@ on:
|
|
|
release:
|
|
|
types: [published]
|
|
|
workflow_dispatch:
|
|
|
+ inputs:
|
|
|
+ tag_name:
|
|
|
+ description: 'Tag name (leave empty for latest release)'
|
|
|
+ required: false
|
|
|
+ type: string
|
|
|
+
|
|
|
jobs:
|
|
|
Discord:
|
|
|
runs-on: ubuntu-latest
|
|
@@ -12,37 +18,74 @@ jobs:
|
|
|
- uses: actions/checkout@v4
|
|
|
with:
|
|
|
fetch-depth: 0
|
|
|
+
|
|
|
+ - name: Get release info
|
|
|
+ id: release-info
|
|
|
+ run: |
|
|
|
+ if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
|
|
+ # Pour trigger manuel, récupère le dernier release ou utilise l'input
|
|
|
+ if [ -n "${{ github.event.inputs.tag_name }}" ]; then
|
|
|
+ TAG_NAME="${{ github.event.inputs.tag_name }}"
|
|
|
+ else
|
|
|
+ TAG_NAME=$(gh release list --limit 1 --json tagName --jq '.[0].tagName')
|
|
|
+ fi
|
|
|
+
|
|
|
+ # Récupère les infos du release via GitHub CLI
|
|
|
+ RELEASE_INFO=$(gh release view "$TAG_NAME" --json name,body,htmlUrl,author,publishedAt,tagName)
|
|
|
+
|
|
|
+ echo "tag_name=$(echo "$RELEASE_INFO" | jq -r '.tagName')" >> $GITHUB_OUTPUT
|
|
|
+ echo "name=$(echo "$RELEASE_INFO" | jq -r '.name')" >> $GITHUB_OUTPUT
|
|
|
+ echo "body=$(echo "$RELEASE_INFO" | jq -r '.body')" >> $GITHUB_OUTPUT
|
|
|
+ echo "html_url=$(echo "$RELEASE_INFO" | jq -r '.htmlUrl')" >> $GITHUB_OUTPUT
|
|
|
+ echo "author_login=$(echo "$RELEASE_INFO" | jq -r '.author.login')" >> $GITHUB_OUTPUT
|
|
|
+ echo "author_html_url=https://github.com/$(echo "$RELEASE_INFO" | jq -r '.author.login')" >> $GITHUB_OUTPUT
|
|
|
+ echo "published_at=$(echo "$RELEASE_INFO" | jq -r '.publishedAt')" >> $GITHUB_OUTPUT
|
|
|
+ else
|
|
|
+ # Pour trigger automatique, utilise les données de l'événement
|
|
|
+ echo "tag_name=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT
|
|
|
+ echo "name=${{ github.event.release.name }}" >> $GITHUB_OUTPUT
|
|
|
+ echo "body=${{ github.event.release.body }}" >> $GITHUB_OUTPUT
|
|
|
+ echo "html_url=${{ github.event.release.html_url }}" >> $GITHUB_OUTPUT
|
|
|
+ echo "author_login=${{ github.event.release.author.login }}" >> $GITHUB_OUTPUT
|
|
|
+ echo "author_html_url=${{ github.event.release.author.html_url }}" >> $GITHUB_OUTPUT
|
|
|
+ echo "published_at=${{ github.event.release.published_at }}" >> $GITHUB_OUTPUT
|
|
|
+ fi
|
|
|
+ env:
|
|
|
+ GH_TOKEN: ${{ github.token }}
|
|
|
+
|
|
|
- name: Get previous release
|
|
|
id: previous-release
|
|
|
run: |
|
|
|
- PREV_TAG=$(git tag --sort=-version:refname | grep -v '${{ github.event.release.tag_name }}' | head -n1)
|
|
|
+ PREV_TAG=$(git tag --sort=-version:refname | grep -v '${{ steps.release-info.outputs.tag_name }}' | head -n1)
|
|
|
echo "previous_tag=${PREV_TAG}" >> $GITHUB_OUTPUT
|
|
|
+
|
|
|
- name: Get changed files since last release
|
|
|
id: changed-files
|
|
|
uses: tj-actions/changed-files@v44
|
|
|
with:
|
|
|
base_sha: ${{ steps.previous-release.outputs.previous_tag }}
|
|
|
separator: "\n• "
|
|
|
+
|
|
|
- name: Discord notification
|
|
|
env:
|
|
|
DISCORD_WEBHOOK: ${{ secrets.DISCORD_RELEASE_WEBHOOK }}
|
|
|
DISCORD_AVATAR: 'https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png'
|
|
|
DISCORD_EMBEDS: '[{
|
|
|
- "title": "🚀 New Release: ${{ github.event.release.tag_name }}",
|
|
|
- "description": "${{ github.event.release.name }}\n\n${{ github.event.release.body }}",
|
|
|
- "url": "${{ github.event.release.html_url }}",
|
|
|
+ "title": "🚀 New Release: ${{ steps.release-info.outputs.tag_name }}",
|
|
|
+ "description": "${{ steps.release-info.outputs.name }}\n\n${{ steps.release-info.outputs.body }}",
|
|
|
+ "url": "${{ steps.release-info.outputs.html_url }}",
|
|
|
"color": 5763719,
|
|
|
"thumbnail": {
|
|
|
"url": "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png"
|
|
|
},
|
|
|
"fields": [
|
|
|
- { "name": "📦 Version", "value": "`${{ github.event.release.tag_name }}`", "inline": true },
|
|
|
- { "name": "👤 Released by", "value": "[${{ github.event.release.author.login }}](${{ github.event.release.author.html_url }})", "inline": true },
|
|
|
+ { "name": "📦 Version", "value": "`${{ steps.release-info.outputs.tag_name }}`", "inline": true },
|
|
|
+ { "name": "👤 Released by", "value": "[${{ steps.release-info.outputs.author_login }}](${{ steps.release-info.outputs.author_html_url }})", "inline": true },
|
|
|
{ "name": "📁 Repository", "value": "[${{ github.event.repository.name }}](${{ github.event.repository.html_url }})", "inline": true },
|
|
|
- { "name": "🔗 Download", "value": "[Release Page](${{ github.event.release.html_url }})", "inline": true },
|
|
|
+ { "name": "🔗 Download", "value": "[Release Page](${{ steps.release-info.outputs.html_url }})", "inline": true },
|
|
|
{ "name": "📝 Files Changed", "value": "• ${{ steps.changed-files.outputs.all_changed_files }}", "inline": false }
|
|
|
],
|
|
|
- "timestamp": "${{ github.event.release.published_at }}",
|
|
|
+ "timestamp": "${{ steps.release-info.outputs.published_at }}",
|
|
|
"footer": {
|
|
|
"text": "Workout Cool • Release",
|
|
|
"icon_url": "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png"
|