Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update release.yml #54

Merged
merged 1 commit into from
Oct 29, 2024
Merged

Update release.yml #54

merged 1 commit into from
Oct 29, 2024

Conversation

amontoison
Copy link
Contributor

@amontoison amontoison commented Oct 29, 2024

@cvanaret
I tested the script for the release on my fork and added some fixes.
I have now an example of release automatically generated here:
https://github.com/amontoison/Uno/releases/tag/v1.2.0

@cvanaret cvanaret merged commit 6f30328 into cvanaret:main Oct 29, 2024
3 checks passed
@cvanaret
Copy link
Owner

Neat stuff! Thank you!

@amontoison amontoison deleted the hotfix branch November 1, 2024 07:21
@cvanaret
Copy link
Owner

cvanaret commented Nov 4, 2024

@amontoison do you know if there's a way to automatically create a new discussion for the release in Announcements, like #15?

@amontoison
Copy link
Contributor Author

@cvanaret
I never implemented a workflow for that but somethink like this should work:

name: Post Release Announcement

on:
  release:
    types: [published]  # Se déclenche lorsqu'une release est publiée

jobs:
  delay_and_announce:
    runs-on: ubuntu-latest

    steps:
    - name: Attendre 24 heures
      run: sleep $((24 * 60 * 60))  # Attend 24 heures (86400 secondes)

    - name: Obtenir les notes de release
      id: get_release_notes
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      run: |
        # Récupère les informations de la dernière release
        response=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
          -H "Accept: application/vnd.github.v3+json" \
          https://api.github.com/repos/${{ github.repository }}/releases/latest)
        
        # Extraire le titre et le corps de la release
        echo "::set-output name=title::$(echo "$response" | jq -r '.name')"
        echo "::set-output name=body::$(echo "$response" | jq -r '.body')"

    - name: Poster l'annonce dans les Discussions
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      run: |
        # Remplacez '123456' par l'ID de la catégorie où l'annonce doit être postée
        curl -X POST -H "Authorization: token $GITHUB_TOKEN" \
          -H "Accept: application/vnd.github.v3+json" \
          https://api.github.com/repos/${{ github.repository }}/discussions \
          -d "{\"title\": \"Nouvelle Release : ${{ steps.get_release_notes.outputs.title }}\", \"body\": \"${{ steps.get_release_notes.outputs.body }}\", \"category_id\": 123456}"

The idea is to wait a few hours or one day after that a release is created to do a new announcement.

It will copy-paste the content of the release note and use it for the announcement.
I added a "sleep" because the workflow that cross-compiles binaries and create the release doesn't contain the changelog / release note.
So it will give you one day to add it before that the announcement is created.

@cvanaret
Copy link
Owner

cvanaret commented Nov 5, 2024

@amontoison thank you very much!

@amontoison
Copy link
Contributor Author

amontoison commented Nov 6, 2024

Do you want that I open a PR to add a workflow?
I can do that next week and try it on my fork.

@cvanaret
Copy link
Owner

cvanaret commented Nov 6, 2024

If you find time, sure. It's not urgent though.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants