56 lines
2.0 KiB
YAML
56 lines
2.0 KiB
YAML
name: Create GH release and Notify Slack
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
milestone:
|
|
description: 'Milestone title, e.g 3.0.0-M1, 3.1.0-RC1, 3.2.0 etc.'
|
|
required: true
|
|
type: string
|
|
|
|
env:
|
|
MILESTONE: ${{ inputs.milestone }}
|
|
GITHUB_TOKEN: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
|
|
|
|
jobs:
|
|
finalize-releae:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
show-progress: false
|
|
|
|
- name: Generate Changelog
|
|
run: |
|
|
repositoryTeam=$(gh api repos/$GITHUB_REPOSITORY/collaborators --jq 'map(select(.role_name == "admin") | .login) | tostring')
|
|
repositoryTeam=$(sed 's/"//g' <<< ${repositoryTeam:1:-1})
|
|
|
|
wget -q https://github.com/spring-io/github-changelog-generator/releases/download/v0.0.8/github-changelog-generator.jar
|
|
|
|
java -jar github-changelog-generator.jar $MILESTONE changelog.md \
|
|
--changelog.repository=$GITHUB_REPOSITORY \
|
|
--github.username=spring-builds \
|
|
--github.password=$GITHUB_TOKEN \
|
|
--changelog.contributors.exclude.names=$repositoryTeam
|
|
|
|
- name: GitHub Release
|
|
run: gh release create v${{ env.MILESTONE }} -F changelog.md ${{ (contains(env.MILESTONE, '-M') || contains(env.MILESTONE, '-RC')) && '--prerelease' }}
|
|
|
|
- name: Close Milestone
|
|
run: |
|
|
MILESTONE_ID=$(gh api repos/$GITHUB_REPOSITORY/milestones --jq '.[] | select(.title == env.MILESTONE) | .number')
|
|
if [ $MILESTONE_ID ]; then
|
|
gh api -X PATCH repos/$GITHUB_REPOSITORY/milestones/$MILESTONE_ID -f state='closed' --silent
|
|
fi
|
|
|
|
# - name: Announce Release on Slack
|
|
# uses: slackapi/slack-github-action@v1.24.0
|
|
# env:
|
|
# SLACK_WEBHOOK_URL: ${{ secrets.SPRING_RELEASE_SLACK_WEBHOOK_URL }}
|
|
# SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
|
|
# with:
|
|
# payload: |
|
|
# {
|
|
# "text": "${{ github.event.repository.name }}-announcing `${{ env.MILESTONE }}`"
|
|
# } |