|
1 |
| -name: Post Release Workflow |
| 1 | +name: Post Release Tasks |
2 | 2 |
|
3 | 3 | on:
|
4 |
| - workflow_dispatch: # Enables manual trigger |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + github_ref_name: |
| 7 | + description: "Current release tag in this train (e.g., v1.15.3)" |
| 8 | + required: true |
| 9 | + previous_ref_name: |
| 10 | + description: "Previous release tag in this train (e.g., v1.14.8)" |
| 11 | + required: false |
5 | 12 |
|
6 | 13 | jobs:
|
7 |
| - generate-release-notes: |
8 |
| - name: Generate Release Notes |
| 14 | + post_release: |
9 | 15 | runs-on: ubuntu-latest
|
10 | 16 |
|
11 | 17 | steps:
|
12 |
| - - name: Check out the repository |
13 |
| - uses: actions/checkout@v3 |
14 |
| - |
15 |
| - - name: Download Changelog Generator |
16 |
| - run: | |
17 |
| - curl -L -o github-changelog-generator.jar https://github.com/spring-io/github-changelog-generator/releases/download/v0.0.11/github-changelog-generator.jar |
18 |
| -
|
19 |
| - - name: Generate release notes |
20 |
| - id: generate_notes |
21 |
| - run: | |
22 |
| - java -jar github-changelog-generator.jar \ |
23 |
| - ${GITHUB_REF_NAME#v} \ |
24 |
| - changelog.md \ |
25 |
| - --changelog.repository="${{ github.repository }}" \ |
26 |
| - --github.token="${{ secrets.GITHUB_TOKEN }}" |
27 |
| -
|
28 |
| - - name: Run script to process Markdown file |
29 |
| - run: python .github/workflows/process_changelog.py |
30 |
| - |
31 |
| - - name: Update release text |
32 |
| - run: | |
33 |
| - echo -e "::Info::Original changelog\n\n" |
34 |
| - cat changelog.md |
35 |
| - |
36 |
| - echo -e "\n\n" |
37 |
| - echo -e "::Info::Processed changelog\n\n" |
38 |
| - cat changelog-output.md |
39 |
| - gh release edit ${{ github.ref_name }} --notes-file changelog-output.md |
40 |
| - env: |
41 |
| - GH_TOKEN: ${{ secrets.GH_ACTIONS_REPO_TOKEN }} |
42 |
| - |
43 |
| - close-milestone: |
44 |
| - name: Close Milestone |
45 |
| - runs-on: ubuntu-latest |
46 |
| - needs: generate-release-notes |
47 |
| - steps: |
48 |
| - - name: Close milestone |
49 |
| - run: | |
50 |
| - # Extract version without 'v' prefix |
51 |
| - milestone_name=${GITHUB_REF_NAME#v} |
52 |
| - |
53 |
| - echo "Closing milestone: $milestone_name" |
54 |
| - |
55 |
| - # List milestones and find the ID |
56 |
| - milestone_id=$(gh api "/repos/${{ github.repository }}/milestones?state=open" \ |
57 |
| - --jq ".[] | select(.title == \"$milestone_name\").number") |
58 |
| - |
59 |
| - if [ -z "$milestone_id" ]; then |
60 |
| - echo "::error::Milestone '$milestone_name' not found" |
61 |
| - exit 1 |
62 |
| - fi |
63 |
| - |
64 |
| - # Close the milestone |
65 |
| - gh api --method PATCH "/repos/${{ github.repository }}/milestones/$milestone_id" \ |
66 |
| - -f state=closed |
67 |
| - |
68 |
| - echo "Successfully closed milestone: $milestone_name" |
69 |
| - env: |
70 |
| - GH_TOKEN: ${{ secrets.GH_ACTIONS_REPO_TOKEN }} |
71 |
| - |
72 |
| - notify: |
73 |
| - name: Send Notifications |
74 |
| - runs-on: ubuntu-latest |
75 |
| - needs: close-milestone |
76 |
| - |
77 |
| - steps: |
78 |
| - - name: Announce Release on `Spring-Releases` space |
79 |
| - run: | |
80 |
| - milestone_name=${GITHUB_REF_NAME#v} |
81 |
| - curl --location --request POST '${{ secrets.SPRING_RELEASE_GCHAT_WEBHOOK_URL }}' \ |
82 |
| - --header 'Content-Type: application/json' \ |
83 |
| - --data-raw '{ text: "${{ github.event.repository.name }}-announcing ${milestone_name}"}' |
84 |
| -
|
85 |
| - - name: Post on Bluesky |
86 |
| - env: |
87 |
| - BSKY_IDENTIFIER: ${{ secrets.BLUESKY_HANDLE }} |
88 |
| - BSKY_PASSWORD: ${{ secrets.BLUESKY_PASSWORD }} |
89 |
| - run: | |
90 |
| - # First get the session token |
91 |
| - SESSION_TOKEN=$(curl -s -X POST https://bsky.social/xrpc/com.atproto.server.createSession \ |
92 |
| - -H "Content-Type: application/json" \ |
93 |
| - -d "{\"identifier\":\"$BSKY_IDENTIFIER\",\"password\":\"$BSKY_PASSWORD\"}" | \ |
94 |
| - jq -r .accessJwt) |
95 |
| -
|
96 |
| - # Create post content |
97 |
| - VERSION=${GITHUB_REF_NAME#v} |
98 |
| - POST_TEXT="${{ github.event.repository.name }} ${VERSION} has been released!\n\nCheck out the changelog: https://github.com/${GITHUB_REPOSITORY}/releases/tag/${GITHUB_REF_NAME}" |
99 |
| -
|
100 |
| - # Create the post |
101 |
| - curl -X POST https://bsky.social/xrpc/com.atproto.repo.createRecord \ |
102 |
| - -H "Content-Type: application/json" \ |
103 |
| - -H "Authorization: Bearer ${SESSION_TOKEN}" \ |
104 |
| - -d "{ |
105 |
| - \"repo\": \"$BSKY_IDENTIFIER\", |
106 |
| - \"collection\": \"app.bsky.feed.post\", |
107 |
| - \"record\": { |
108 |
| - \"\$type\": \"app.bsky.feed.post\", |
109 |
| - \"text\": \"$POST_TEXT\", |
110 |
| - \"createdAt\": \"$(date -u +"%Y-%m-%dT%H:%M:%S.000Z")\" |
111 |
| - } |
112 |
| - }" |
| 18 | + - uses: actions/checkout@v4 |
| 19 | + |
| 20 | + - name: Run Post Release Tasks |
| 21 | + uses: marcingrzejszczak/[email protected] |
| 22 | + with: |
| 23 | + gh_token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }} |
| 24 | + github_ref_name: ${{ github.event.inputs.github_ref_name }} |
| 25 | + previous_ref_name: ${{ github.event.inputs.previous_ref_name }} |
| 26 | + spring_release_gchat_webhook_url: ${{ secrets.SPRING_RELEASE_GCHAT_WEBHOOK_URL }} |
| 27 | + bluesky_handle: ${{ secrets.BLUESKY_HANDLE }} |
| 28 | + bluesky_password: ${{ secrets.BLUESKY_PASSWORD }} |
0 commit comments