generated from ansible-collections/collection_template
-
-
Notifications
You must be signed in to change notification settings - Fork 12
79 lines (61 loc) · 2.39 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: GitHub Release
on:
workflow_dispatch:
inputs:
version:
description: "Version number to release"
required: true
env:
GHP_BASE_URL: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}
jobs:
release:
name: Create GitHub Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Install PyYaml
run: pip install pyyaml
- name: Publish to Galaxy
uses: artis3n/[email protected]
with:
api_key: ${{ secrets.GALAXY_API_KEY }}
- name: Validate version is published to Galaxy
run: curl --head -s -f -o /dev/null https://galaxy.ansible.com/download/lowlydba-sqlserver-${{ github.event.inputs.version }}.tar.gz
- name: Build release description
shell: python
run: |
import os
import yaml
ver = '${{ github.event.inputs.version }}'
ver_anchor = str.replace(ver, '.', '-')
with open('changelogs/changelog.yaml', 'r') as s:
ri = yaml.safe_load(s)
if ('release_summary' not in ri['releases'][ver]['changes']):
summary = 'No release summary available.'
else:
summary = ri['releases'][ver]['changes']['release_summary']
reldate = ri['releases'][ver]['release_date']
description = '''## Summary
Released: %s
%s
---
View the [complete changelog](https://github.com/lowlydba/lowlydba.sqlserver/blob/main/CHANGELOG.rst#v%s) to see all changes.
View the [full documentation for release ${{ github.event.inputs.version }}](${{ env.GHP_BASE_URL }}/tag/${{ github.event.inputs.version }}).
''' % (reldate, summary, ver_anchor)
with open(os.environ['GITHUB_ENV'], 'a') as e:
e.write("RELEASE_DESCRIPTION<<EOF\n%s\nEOF" % description)
- name: Create Release
id: create_release
uses: softprops/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
token: ${{ env.GITHUB_TOKEN }}
tag_name: ${{ github.event.inputs.version }}
name: ${{ github.event.inputs.version }}
body: ${{ env.RELEASE_DESCRIPTION }}