Debian Codegraph @

ansible_collections/community/hashi_vault/.github/workflows/github-release.yml

raw
1 name: GitHub Release
2 on:
3 workflow_dispatch:
4 inputs:
5 version:
6 description: 'Version number to release'
7 required: true
8
9 env:
10 GHP_BASE_URL: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}
11
12 jobs:
13 release:
14 name: Create GitHub Release
15 runs-on: ubuntu-latest
16 steps:
17 - name: Checkout
18 uses: actions/checkout@v5
19 with:
20 show-progress: false
21
22 - name: Set up Python
23 uses: actions/setup-python@v6
24 with:
25 python-version: 3.13
26
27 - name: Install PyYaml
28 run: pip install pyyaml ansible-core
29
30 - name: Validate version is published to Galaxy
31 run: ansible-galaxy collection download -vvv -p /tmp 'community.hashi_vault:==${{ github.event.inputs.version }}'
32
33 - name: Build release description
34 shell: python
35 run: |
36 import os
37 import yaml
38
39 ver = '${{ github.event.inputs.version }}'
40 ver_anchor = str.replace(ver, '.', '-')
41
42 with open('changelogs/changelog.yaml', 'r') as s:
43 ri = yaml.safe_load(s)
44
45 summary = ri['releases'][ver]['changes']['release_summary']
46 reldate = ri['releases'][ver]['release_date']
47
48 description = '''## Summary
49 Released: %s
50
51 %s
52
53 ---
54
55 View the [complete changelog](https://github.com/ansible-collections/community.hashi_vault/blob/main/CHANGELOG.rst#v%s) to see all changes.
56
57 View the [full documentation for release ${{ github.event.inputs.version }}](${{ env.GHP_BASE_URL }}/tag/${{ github.event.inputs.version }}).
58 ''' % (reldate, summary, ver_anchor)
59
60 with open(os.environ['GITHUB_ENV'], 'a') as e:
61 e.write("RELEASE_DESCRIPTION<<EOF\n%s\nEOF" % description)
62
63 - name: Create Release
64 id: create_release
65 # TODO: this action is no longer maintained, replace
66 # likely candidate: https://github.com/softprops/action-gh-release
67 uses: actions/create-release@v1
68 env:
69 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70 with:
71 tag_name: ${{ github.event.inputs.version }}
72 release_name: ${{ github.event.inputs.version }}
73 body: ${{ env.RELEASE_DESCRIPTION }}