forked from theforeman/foreman-packaging
-
Notifications
You must be signed in to change notification settings - Fork 0
124 lines (115 loc) · 3.95 KB
/
bump_packages.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
119
120
121
122
123
124
name: Update packages
on:
workflow_dispatch:
schedule:
- cron: '4 4 * * 0'
env:
GIT_AUTHOR_NAME: Foreman Packaging Automation
GIT_AUTHOR_EMAIL: [email protected]
jobs:
rpm_list:
name: 'Gather RPMs'
runs-on: ubuntu-latest
if: github.repository_owner == 'theforeman'
outputs:
matrix: ${{ steps.set_list.outputs.matrix }}
steps:
- name: Checkout RPM
uses: actions/checkout@v3
with:
ref: rpm/develop
- name: Set the list
id: set_list
run: ./list_updatable_packages
bump_rpm:
name: 'Bump ${{ matrix.package_name }} RPM ${{ matrix.new_version }}'
needs: rpm_list
if: ${{ needs.rpm_list.outputs.matrix != '[]' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.rpm_list.outputs.matrix) }}
steps:
- name: Install dependencies
run: |
sudo apt-get install -y --no-install-recommends rpm git-annex python3-semver
sudo gem install gem2rpm --no-document
sudo curl --create-dirs -o /usr/local/bin/spectool https://pagure.io/rpmdevtools/raw/26a8abc746fba9c0b32eb899b96c92841a37855a/f/spectool.in
echo 'echo "$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>"' | sudo tee /usr/local/bin/rpmdev-packager
sudo chmod +x /usr/local/bin/spectool /usr/local/bin/rpmdev-packager
- name: Checkout RPM
uses: actions/checkout@v3
with:
ref: rpm/develop
- name: Initialize git annex
run: git annex init
- name: Bump ${{ matrix.package_name }} to ${{ matrix.new_version }}
run: ./bump_rpm.sh "${{ matrix.directory }}" "${{ matrix.new_version }}"
env:
SKIP_GIT_COMMIT: 1
- name: Open a PR
uses: peter-evans/create-pull-request@v5
with:
commit-message: "Update ${{ matrix.package_name }} to ${{ matrix.new_version }}"
branch: "bump_rpm/${{ matrix.package_name }}"
title: "Update ${{ matrix.package_name }} to ${{ matrix.new_version }}"
body: ''
delete-branch: true
deb_list:
name: 'Gather debs'
runs-on: ubuntu-latest
if: github.repository_owner == 'theforeman'
outputs:
matrix: ${{ steps.set_list.outputs.matrix }}
steps:
- name: Checkout deb
uses: actions/checkout@v3
with:
ref: deb/develop
- name: Set the list
id: set_list
run: ./scripts/list_updatable_packages
bump_plugin_deb:
name: 'Bump ${{ matrix.package_name }} deb ${{ matrix.new_version }}'
needs: deb_list
if: ${{ needs.deb_list.outputs.matrix != '[]' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.deb_list.outputs.matrix) }}
steps:
- name: Checkout DEB
uses: actions/checkout@v3
with:
ref: deb/develop
- name: Update package
run: ./scripts/update_package.rb --name "$(basename ${{ matrix.directory }})" --version "${{ matrix.new_version }}"
- name: Open a PR
uses: peter-evans/create-pull-request@v5
with:
commit-message: "Update ${{ matrix.package_name }} to ${{ matrix.new_version }}"
branch: "bump_deb/${{ matrix.package_name }}"
title: "Update ${{ matrix.package_name }} to ${{ matrix.new_version }}"
body: ''
delete-branch: true
report:
name: Report failure to Discourse
needs:
- bump_plugin_deb
- bump_rpm
runs-on: ubuntu-latest
if: failure()
steps:
- name: Send email to Discourse on failure
uses: dawidd6/action-send-mail@v3
with:
server_address: community.theforeman.org
server_port: 25
subject: "foreman-packaging update packages Github Action ${{ github.run_id }} failed"
from: Foreman Github Actions <[email protected]>
body: |
foreman-packaging update packages Github Action failed
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}