-
Notifications
You must be signed in to change notification settings - Fork 7
118 lines (101 loc) · 3.63 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
---
name: Release
on:
release:
types:
- published
jobs:
ansible-lint:
uses: redhat-cop/infra.lvm_snapshots/.github/workflows/ansible-lint.yml@main
pylint:
uses: redhat-cop/infra.lvm_snapshots/.github/workflows/pylint.yml@main
shellcheck:
uses: redhat-cop/infra.lvm_snapshots/.github/workflows/shellcheck.yml@main
prechecks:
needs:
- ansible-lint
- pylint
- shellcheck
runs-on: ubuntu-latest
steps:
- run: >-
python -c "assert set([
'${{ needs.ansible-lint.result }}',
'${{ needs.pylint.result }}',
]) == {'success'}"
infra_release:
needs:
- prechecks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install Ansible
run: pip install --upgrade ansible-core
- name: Update version in galaxy.yml
run: sed -i 's/version:.*$/version:{{:dumb_space_issue:}}${{ github.ref_name }}/' galaxy.yml; sed -i 's/{{:dumb_space_issue:}}/ /' galaxy.yml
- name: Build collection
run: ansible-galaxy collection build -vvv
shell: bash
working-directory: ${{ vars.GITHUB_PATH }}
- name: Get tar name
run: echo "tar_file=$(ls | grep '.tar')" >> $GITHUB_OUTPUT
id: build
- name: Get version
run: echo "NUM=$(cat galaxy.yml | grep version | cut -d ':' -f 2 | awk '{print $1}')" >> $GITHUB_OUTPUT
id: vers
- name: Install collection
run: ansible-galaxy collection install ./infra-lvm_snapshots-${{ steps.vers.outputs.NUM }}.tar.gz -p /home/runner/collections
shell: bash
working-directory: ${{ vars.GITHUB_PATH }}
- name: Publish to galaxy
run: ansible-galaxy collection publish --api-key=${{ secrets.GALAXY_INFRA_KEY }} ${{ steps.build.outputs.tar_file }}
- name: Upload files to tag
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.build.outputs.tar_file }}
tag: ${{ github.ref }}
overwrite: true
changelog:
needs:
- infra_release
runs-on: ubuntu-latest
env:
ANSIBLE_FORCE_COLOR: 1
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install Ansible
run: pip install --upgrade ansible-core antsibull-changelog
- name: Update version in galaxy.yml
run: sed -i 's/version:.*$/version:{{:dumb_space_issue:}}${{ github.ref_name }}/' galaxy.yml; sed -i 's/{{:dumb_space_issue:}}/ /' galaxy.yml
- name: Run changelog
run: antsibull-changelog release --verbose --version ${{ github.ref_name }}
- name: Create Pull Request
id: prcreate
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update changelog ${{ github.ref_name }}
committer: GitHub <noreply@github.com>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
signoff: false
base: main
branch: changelog-patches
delete-branch: true
title: '[RELEASE] Update changelog ${{ github.ref_name }}'
body: |
Update changelog
- Updated with changelog for release ${{ github.ref_name }}
- Auto-generated by [create-pull-request][1]
[1]: https://github.com/peter-evans/create-pull-request
labels: |
changelog
automated pr
draft: false
...