Build Packages #40
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Packages | |
on: | |
push: | |
tags: '[0-9]+.[0-9]+.[0-9]+-*' | |
schedule: | |
# If this workflow changes in the future to uploading RPMs directly to a | |
# release on tag push, then a conditional check should be added for the | |
# cron to continue uploading as an artifact on the workflow build. | |
- cron: '41 22 * * SUN' | |
jobs: | |
build-rpm: | |
runs-on: ubuntu-latest | |
if: '!github.event.repository.fork' | |
env: | |
# _github_home is the dir used as a volume by the container | |
RPMDIR: /home/runner/work/_temp/_github_home/rpmbuild | |
steps: | |
- name: Install rpmlint | |
run: | | |
sudo apt-get update | |
sudo apt-get install rpmlint | |
- uses: actions/checkout@v4 | |
with: | |
# Get all branches and tags so the latest tag can be found for VERSION | |
fetch-depth: 0 | |
- name: Set VERSION | |
run: echo "VERSION=`echo $(git describe --tags $(git rev-list --tags --max-count=1))`" >> $GITHUB_ENV | |
- name: Set SSMDIR | |
run: echo "SSMDIR=apel-ssm-$VERSION" >> $GITHUB_ENV | |
# Based on the ssm-build-rpm.sh script | |
- name: Download and rename archive | |
run: | | |
wget --no-check-certificate https://github.com/apel/ssm/archive/$VERSION.tar.gz -O $VERSION | |
tar xzvf $VERSION | |
mv ssm-$VERSION $SSMDIR | |
tar czvf $SSMDIR.tar.gz $SSMDIR | |
sudo mkdir -p $RPMDIR/SOURCES | |
sudo cp $SSMDIR.tar.gz $RPMDIR/SOURCES | |
- name: Build RPM package | |
id: rpm | |
uses: naveenrajm7/[email protected] | |
with: | |
spec_file: "apel-ssm.spec" | |
- name: Lint RPMs | |
continue-on-error: true | |
run: rpmlint ${{ steps.rpm.outputs.rpm_dir_path }} | |
- name: Upload artifact | |
uses: actions/[email protected] | |
with: | |
name: Binary and Source RPMs | |
path: | | |
${{ steps.rpm.outputs.rpm_dir_path }} | |
${{ steps.rpm.outputs.source_rpm_dir_path }} |