-
Notifications
You must be signed in to change notification settings - Fork 148
133 lines (124 loc) · 4.37 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
125
126
127
128
129
130
131
132
133
name: Update packages
on:
workflow_dispatch:
schedule:
- cron: '4 4 * * 0,3'
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@v4
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
sudo curl --create-dirs -o /usr/local/bin/rpmdev-bumpspec https://pagure.io/rpmdevtools/raw/6f387c1deaa5cbed770310e288abde04b17421dc/f/rpmdev-bumpspec
printf '#!/bin/bash\necho "$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>"' | sudo tee /usr/local/bin/rpmdev-packager
sudo chmod +x /usr/local/bin/spectool /usr/local/bin/rpmdev-*
- name: Install dependencies for nodejs
if: ${{ matrix.npm_name != null }}
uses: actions/setup-node@v4
with:
node-version: 12
- name: Install npm2rpm
if: ${{ matrix.npm_name != null }}
run: npm install --global npm2rpm
- name: Checkout RPM
uses: actions/checkout@v4
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@v7
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@v4
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@v4
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@v7
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 }}