75091ea3e52711f9d29dd521a4d3532d4501da49
[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         with:
15           fetch-depth: 30
16           fetch-tags: true
17       - name: Get tag
18         id: tag
19         uses: devops-actions/action-get-tag@v1.0.2
20       - name: Convert tag
21         run: >-
22           VER=$(echo "${{ steps.tag.outputs.tag }}" | tr . -)
23           echo "ANCHOR=${VER}" >> $GITHUB_ENV
24       - name: Notify mailing list
25         uses: dawidd6/action-send-mail@v3
26         with:
27           server_address: ${{ vars.MAIL_SERVER }}
28           server_port: ${{ vars.MAIL_SERVER_PORT }}
29           secure: true
30           username: ${{ secrets.MAIL_USER }}
31           password: ${{ secrets.MAIL_PASSWORD }}
32           subject: global-jjb ${{ steps.tag.outputs.tag }} released
33           to: lf-releng@lists.linuxfoundation.org
34           from: ${{ vars.MAIL_FROM }}
35           body: |
36             Hi Everyone,
37
38             global-jjb ${{ steps.tag.outputs.tag }} is released. Thanks to everyone who contributed
39             to this release. Release notes are avaiable online at:
40
41             https://docs.releng.linuxfoundation.org/projects/global-jjb/en/stable/release-notes.html#${{ env.ANCHOR }}
42
43             Cheers,
44             LF Releng
45       - name: Configure Python
46         uses: actions/setup-python@v4
47         with:
48           python-version: "3.8"
49       - name: Generate reno report
50         run: >-
51           pipx run tox -e reno -- report \
52             --version "${{ steps.tag.outputs.tag }}" \
53             2>/dev/null > reno-notes.md || true
54           if grep -q 'reno: FAIL' reno-notes.md
55           then
56             touch modified-reno-notes.md
57           else
58             sed '/^\.pkg.*$/d' reno-notes.md |
59             sed '/^reno:.*$/d' |
60             sed '/^\.\. .*$/d' |
61             sed '$d' |
62             sed '$d' |
63             sed '1d' > modified-reno-notes.md
64           fi
65       - name: Create Release Notes
66         run: >-
67           gh release create ${{ steps.tag.outputs.tag }} --generate-notes \
68             -F modified-reno-notes.md
69         env:
70           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}