Chore: Update GitHub setup-python action from v4 -> v5
[releng/global-jjb.git] / .github / workflows / release.yaml
1 ---
2 name: Release announcement
3
4 # yamllint disable-line rule:truthy
5 on: push
6
7 jobs:
8   publish:
9     if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
10     runs-on: ubuntu-latest
11     steps:
12       - name: Checkout repository
13         uses: actions/checkout@v4
14       - name: Get tag
15         id: tag
16         uses: devops-actions/action-get-tag@v1.0.2
17       - name: Convert tag
18         run: >-
19           VER=$(echo "${{ steps.tag.outputs.tag }}" | tr . -)
20           echo "ANCHOR=${VER}" >> $GITHUB_ENV
21       - name: Notify mailing list
22         uses: dawidd6/action-send-mail@v3
23         with:
24           server_address: ${{ vars.MAIL_SERVER }}
25           server_port: ${{ vars.MAIL_SERVER_PORT }}
26           secure: true
27           username: ${{ secrets.MAIL_USER }}
28           password: ${{ secrets.MAIL_PASSWORD }}
29           subject: global-jjb ${{ steps.tag.outputs.tag }} released
30           to: lf-releng@lists.linuxfoundation.org
31           from: ${{ vars.MAIL_FROM }}
32           body: |
33             Hi Everyone,
34
35             global-jjb ${{ steps.tag.outputs.tag }} is released. Thanks to everyone who contributed
36             to this release. Release notes are avaiable online at:
37
38             https://docs.releng.linuxfoundation.org/projects/global-jjb/en/stable/release-notes.html#${{ env.ANCHOR }}
39
40             Cheers,
41             LF Releng
42       - name: Configure Python
43         uses: actions/setup-python@v5
44         with:
45           python-version: "3.8"
46       - name: Generate reno report
47         run: |
48           # fetch last 30 changes
49           git fetch --depth=30
50           pipx run tox -e reno -- report \
51             --version "${{ steps.tag.outputs.tag }}" \
52             2>/dev/null > reno-notes.md || true
53           if grep -q 'reno: FAIL' reno-notes.md
54           then
55             touch modified-reno-notes.md
56           else
57             sed '/^\.pkg.*$/d' reno-notes.md |
58             sed '/^reno:.*$/d' |
59             sed '/^\.\. .*$/d' |
60             sed '$d' |
61             sed '$d' |
62             sed '1d' > modified-reno-notes.md
63           fi
64       - name: Create Release Notes
65         run: |
66           gh release create ${{ steps.tag.outputs.tag }} --generate-notes \
67             -F modified-reno-notes.md
68         env:
69           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}