Skip to content

Update packages

Update packages #284

Workflow file for this run

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/*
- 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"
to: [email protected]
from: Foreman Github Actions <[email protected]>
body: |
foreman-packaging update packages Github Action failed
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}