683ac84b54a7827661ca97a12394ca465190b5c8
[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: Configure Python
22         uses: actions/setup-python@v5
23         with:
24           python-version: "3.8"
25       - name: Generate reno report
26         run: |
27           # fetch last 30 changes
28           git fetch --depth=30
29           pipx run tox -e reno -- report \
30             --version "${{ steps.tag.outputs.tag }}" \
31             2>/dev/null > reno-notes.md || true
32           if grep -q 'reno: FAIL' reno-notes.md
33           then
34             touch modified-reno-notes.md
35           else
36             sed '/^\.pkg.*$/d' reno-notes.md |
37             sed '/^reno:.*$/d' |
38             sed '/^\.\. .*$/d' |
39             sed '$d' |
40             sed '$d' |
41             sed '1d' > modified-reno-notes.md
42           fi
43       - name: Create Release Notes
44         run: |
45           gh release create ${{ steps.tag.outputs.tag }} --generate-notes \
46             -F modified-reno-notes.md
47         env:
48           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}