Skip to content

Commit

Permalink
new workflows for axosyslog rpm build
Browse files Browse the repository at this point in the history
  • Loading branch information
kozmagabor committed Apr 23, 2024
1 parent 145356d commit 9a32f38
Show file tree
Hide file tree
Showing 3 changed files with 183 additions and 0 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/syslog-ng-create-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Create package from source tarball

on:
workflow_call:
inputs:
source-tarball-artifact-name:
required: true
type: string
dbld-image-mode:
required: true
type: string # cache / build
distros:
required: false
type: string
default: |
[
"almalinux-8",
]
jobs:
create-packages:
name: ${{ matrix.distro }}

runs-on: ubuntu-latest

strategy:
matrix:
distro: ${{ fromJson(inputs.distros) }}
fail-fast: false

steps:
- name: Download source tarball artifact
uses: actions/download-artifact@v4
with:
name: ${{ inputs.source-tarball-artifact-name }}

- name: Extract source tarball
run: |
mkdir syslog-ng
tar --strip-components=1 -xvf syslog-ng*.tar.gz -C syslog-ng
- name: Prepare docker image
working-directory: syslog-ng
run: |
if [[ "${{ inputs.dbld-image-mode }}" = "build" ]]
then
./dbld/rules image-${{ matrix.distro }}
elif [[ "${{ inputs.dbld-image-mode }}" = "cache" ]]
then
./dbld/rules cache-image-${{ matrix.distro }}
else
echo Unexpected input: dbld-image-mode=${{ inputs.dbld-image-mode }}
false
fi
- name: Create package
working-directory: syslog-ng
run: |
./dbld/rules package-${{ matrix.distro }}
- name: Prepare package for artifact
# We want to keep the directory structure starting with ${{ matrix.distro }},
# but it can only be done, if we give its parent directory as `path` to upload-artifact.
# There are other directories in dbld/build which we do not want to upload,
# so let's make a temporary directory and move the ${{ matrix.distro }} directory there.
run: |
mkdir package
cp -r syslog-ng/dbld/build/${{ matrix.distro }} package/
- name: Store package as artifact
uses: actions/upload-artifact@v3
with:
name: package-${{ matrix.distro }}
path: package/*
if-no-files-found: error
84 changes: 84 additions & 0 deletions .github/workflows/syslog-ng-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Packages
on:
workflow_call:
inputs:
repo:
description: 'syslog-ng repository'
required: true
default: 'syslog-ng/syslog-ng'
type: string
version:
description: 'syslog-ng version'
required: true
type: string

workflow_dispatch:
inputs:
repo:
description: 'syslog-ng repository'
required: true
default: 'syslog-ng/syslog-ng'
type: string
version:
description: 'syslog-ng version'
required: true
type: string

jobs:
create-source-tarball:
runs-on: ubuntu-latest
steps:
- name: Get syslog-ng tarball
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release download --repo '${{ inputs.repo }}' -p 'syslog-ng-${{ inputs.version }}.tar.gz' 'syslog-ng-${{ inputs.version }}'
- name: Extract source tarball
run: |
mkdir syslog-ng
tar --strip-components=1 -xvf syslog-ng*.tar.gz -C syslog-ng
rm syslog-ng*.tar.gz
- name: AxoSyslog patches
working-directory: syslog-ng
run: |
sed -i 's/Name: syslog-ng/Name: axosyslog/' packaging/rhel/syslog-ng.spec
sed -i 's|%{name}-%{version}.tar.gz|syslog-ng-%{version}.tar.gz|' packaging/rhel/syslog-ng.spec
sed -i 's|URL.*|URL: https://axoflow.com/docs/axosyslog-core/|' packaging/rhel/syslog-ng.spec
sed -i 's|Provides: syslog|&\n\nConflicts: syslog-ng\nConflicts: syslog-ng-premium-edition|' packaging/rhel/syslog-ng.spec
sed -i 's|%setup -q|%setup -q -n syslog-ng-%{version}|' packaging/rhel/syslog-ng.spec
sed -i 's|/%{name}|/syslog-ng|g' packaging/rhel/syslog-ng.spec
sed -i 's|/lib%{name}|/libsyslog-ng|g' packaging/rhel/syslog-ng.spec
sed -i 's|^.*czanik/syslog-ng-githead.*$||' dbld/builddeps
# Remove extra dependencies
sed -i 's|almalinux.*|&,nocriterion,noriemann,nokafka,nomqtt,nojava|' dbld/build.manifest
cat packaging/rhel/syslog-ng.spec
- name: Prepare docker image
working-directory: syslog-ng
run: ./dbld/rules cache-image-tarball

- name: Create source tarball
working-directory: syslog-ng
run: ./dbld/rules pkg-tarball

- name: Store source tarball as artifact
uses: actions/upload-artifact@v4
with:
name: source-tarball
path: syslog-ng/dbld/build/*.tar.*
if-no-files-found: error

create-packages:
needs: create-source-tarball
uses: ./.github/workflows/syslog-ng-create-packages.yml
with:
source-tarball-artifact-name: source-tarball
dbld-image-mode: cache
distros: |
[
"almalinux-8"
]
24 changes: 24 additions & 0 deletions .github/workflows/syslog-ng-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,30 @@ on:
- 'syslog-ng-*'

jobs:
prepare:
name: Prepare Workflow
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Regex matching
uses: kaisugi/action-regex-match@v1.0.0
id: unpack_tag
with:
text: ${{ github.ref }}
regex: 'refs/tags/syslog-ng-(.*)'
outputs:
version: ${{ steps.unpack_tag.outputs.group1 }}

publish-packages:
uses: ./.github/workflows/syslog-ng-packages.yml
needs:
- prepare
with:
repo: syslog-ng/syslog-ng
version: ${{ needs.prepare.outputs.version }}

publish-image:
uses: ./.github/workflows/syslog-ng-docker.yml
with:
Expand Down

0 comments on commit 9a32f38

Please sign in to comment.