Skip to content

Commit

Permalink
Release new version
Browse files Browse the repository at this point in the history
  • Loading branch information
manegron committed Oct 10, 2024
2 parents e3a88d7 + fd476dd commit d2ee48b
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 15 deletions.
19 changes: 18 additions & 1 deletion .github/workflows/rpm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,46 +18,63 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Create tag based on metadata.rb
id: create_tag
run: |
TAG=$(grep -o 'version\s*["'\''][^"'\'']*' ./resources/metadata.rb | sed 's/version\s*["'\'']//;s/["'\'']//')
echo "TAG=$TAG" >> $GITHUB_ENV
shell: bash

- name: Check if Tag Exists
id: check_tag
run: |
if git rev-parse "refs/tags/${{ env.TAG }}" >/dev/null 2>&1; then
echo "Tag ${{ env.TAG }} already exists, exiting."
exit 1
fi
shell: bash

- name: Set Version
if: success()
run: echo "VERSION=${{ env.TAG }}" >> $GITHUB_ENV

- name: Run Docker Container
if: success()
run: docker run --privileged -d --name builder --network host rockylinux:9 /bin/sleep infinity

- name: Install build tools RPM
if: success()
run: |
docker cp ./ builder:/build
docker exec builder bash -c "yum install -y epel-release && yum install -y make git mock"
docker exec builder bash -c "rm -rf /etc/mock/default.cfg"
- name: Setup SDK
if: success()
run: |
docker exec builder bash -c "curl https://raw.githubusercontent.com/redBorder/repoinit/master/sdk9.cfg > /build/sdk9.cfg"
docker exec builder bash -c "echo \"config_opts['use_host_resolv'] = True\" >> /build/sdk9.cfg"
docker exec builder bash -c "ln -s /build/sdk9.cfg /etc/mock/default.cfg"
- name: Build RPM using mock
if: success()
run: |
docker exec builder bash -c "git config --global --add safe.directory /build"
docker exec builder bash -c "cd /build/ && VERSION=${{ env.TAG }} make rpm"
- name: Copy RPMS
if: success()
run: |
docker cp builder:/build/packaging/rpm/pkgs/. ./rpms
- name: Delete non-.rpm files
if: success()
run: |
find ./rpms -type f -not -name '*.rpm' -exec rm {} \;
- name: Release
if: success()
uses: softprops/action-gh-release@v1
with:
files: ./rpms/*
Expand Down
16 changes: 14 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
cookbook rb-arubacentral CHANGELOG
==================================
cookbook-rb-arubacentral CHANGELOG
===============

## 0.0.3

- Miguel Negrón
- [0bcd71f] Add pre and postun to clean the cookbook
- [4f262f7] Update README.md
- [53a29ed] Update rpm.yml
- [8431854] Update metadata.rb
- Miguel Negrón
- [4f262f7] Update README.md
- [53a29ed] Update rpm.yml
- [8431854] Update metadata.rb

0.0.2
-----
Expand Down
23 changes: 16 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
# rb-arubacentral cookbook
# cookbook-rb-arubacentral
[![Build Status][build-shield]][build-url]
[![Linters][linters-shield]][linters-url]
[![License][license-shield]][license-url]

cookbook to install and configure redborder rb-arubacentral
<!-- Badges -->
[build-shield]: https://github.com/redBorder/cookbook-rb-arubacentral/actions/workflows/rpm.yml/badge.svg?branch=master
[build-url]: https://github.com/redBorder/cookbook-rb-arubacentral/actions/workflows/rpm.yml?query=branch%3Amaster
[linters-shield]: https://github.com/redBorder/cookbook-rb-arubacentral/actions/workflows/lint.yml/badge.svg?event=push
[linters-url]: https://github.com/redBorder/cookbook-rb-arubacentral/actions/workflows/lint.yml
[license-shield]: https://img.shields.io/badge/license-AGPLv3-blue.svg
[license-url]: https://github.com/cookbook-rb-arubacentral/blob/HEAD/LICENSE

Chef cookbook to install and configure redborder rb-arubacentral

### Platforms

- Rocky Linux 9

### Chef

- Chef 12.0 or later
- Chef 15.7.0 or later

## Contributing

Expand All @@ -19,8 +30,6 @@ cookbook to install and configure redborder rb-arubacentral
5. Run the tests, ensuring they all pass
6. Submit a Pull Request using Github

## License and Authors

Authors: Enrique Jimenez <ejimenez@redborder.com>
## License

LICENSE: AFFERO GENERAL PUBLIC LICENSE, Version 3, 19 November 2007
GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
14 changes: 13 additions & 1 deletion packaging/rpm/cookbook-rb-arubacentral.spec
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ chmod -R 0755 %{buildroot}/var/chef/cookbooks/rb-arubacentral
install -D -m 0644 README.md %{buildroot}/var/chef/cookbooks/rb-arubacentral/README.md

%pre
if [ -d /var/chef/cookbooks/rb-arubacentral ]; then
rm -rf /var/chef/cookbooks/rb-arubacentral
fi

%post
case "$1" in
Expand All @@ -38,6 +41,12 @@ case "$1" in
;;
esac

%postun
# Deletes directory when uninstall the package
if [ "$1" = 0 ] && [ -d /var/chef/cookbooks/rb-arubacentral ]; then
rm -rf /var/chef/cookbooks/rb-arubacentral
fi

%files
%defattr(0755,root,root)
/var/chef/cookbooks/rb-arubacentral
Expand All @@ -47,5 +56,8 @@ esac
%doc

%changelog
* Mon Jan 15 2024 David Vanhoucke <dvanhoucke@redborder.com> - 0.0.1-1
* Thu Oct 10 2024 Miguel Negrón <manegron@redborder.com>
- Add pre and postun

* Mon Jan 15 2024 David Vanhoucke <dvanhoucke@redborder.com>
- first spec version
8 changes: 4 additions & 4 deletions resources/metadata.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
unified_mode true
name 'rb-arubacentral'
maintainer 'redborder'
maintainer_email 'dvanhoucke@redborder.com'
license 'All rights reserved'
maintainer 'Eneo Tecnología S.L.'
maintainer_email 'git@redborder.com'
license 'AGPL-3.0'
description 'Installs/Configures rb-arubacentral service'
version '0.0.2'
version '0.0.3'

0 comments on commit d2ee48b

Please sign in to comment.