Skip to content

Merge pull request #1215 from maticnetwork/dependabot/go_modules/gola… #7

Merge pull request #1215 from maticnetwork/dependabot/go_modules/gola…

Merge pull request #1215 from maticnetwork/dependabot/go_modules/gola… #7

name: packager_arm_rpm
on:
push:
branches:
- 'master'
paths:
- '**'
tags:
- 'v*.*.*'
- 'v*.*.*-*'
jobs:
build:
permissions:
id-token: write
contents: write
runs-on:
labels: arm-runner-2204
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@master
with:
go-version: 1.22.x
- name: Adding TAG to ENV
run: echo "GIT_TAG=`echo $(git describe --tags --abbrev=0)`" >> $GITHUB_ENV
- name: Adding TAG1 to ENV
run: echo "GIT_TAG1=`echo $(git describe --tags --abbrev=0)`" | sed 's/-/./g' >> $GITHUB_ENV
- name: Cleaning repo
run: make clean
- name: Building for arm64
run: make build
- name: Installing some dependencies
run: sudo apt-get update && sudo apt-get install -y rpm
- name: Setup rpm package for binary aarch64
run: |
mkdir -p packaging/rpm/SPECS
mkdir -p packaging/rpm/BUILD
mkdir -p packaging/rpm/RPMS
mkdir -p packaging/rpm/SRPMS
touch packaging/rpm/heimdall.spec
echo "Name: heimdall" >> packaging/rpm/SPECS/heimdall.spec
echo "Version: ${{ env.GIT_TAG1 }}" >> packaging/rpm/SPECS/heimdall.spec
echo "Release: 1%{?dist}" >> packaging/rpm/SPECS/heimdall.spec
echo "License: GPL/AGPL" >> packaging/rpm/SPECS/heimdall.spec
echo "BuildArch: aarch64" >> packaging/rpm/SPECS/heimdall.spec
echo "Summary: heimdall rpm package" >> packaging/rpm/SPECS/heimdall.spec
echo "%description" >> packaging/rpm/SPECS/heimdall.spec
echo "heimdall rpm package" >> packaging/rpm/SPECS/heimdall.spec
echo "%pre" >> packaging/rpm/SPECS/heimdall.spec
echo "getent group heimdall >/dev/null || groupadd -r heimdall" >> packaging/rpm/SPECS/heimdall.spec
echo "getent passwd heimdall >/dev/null || useradd -s /bin/false -d /var/lib/heimdall -r heimdall -g heimdall" >> packaging/rpm/SPECS/heimdall.spec
echo "%install" >> packaging/rpm/SPECS/heimdall.spec
echo "mkdir -p %{buildroot}/usr/bin" >> packaging/rpm/SPECS/heimdall.spec
echo "cp /home/runner/work/heimdall/heimdall/build/heimdalld %{buildroot}/usr/bin/" >> packaging/rpm/SPECS/heimdall.spec
echo "cp /home/runner/work/heimdall/heimdall/build/heimdallcli %{buildroot}/usr/bin/" >> packaging/rpm/SPECS/heimdall.spec
echo "%files" >> packaging/rpm/SPECS/heimdall.spec
echo "/usr/bin/heimdalld" >> packaging/rpm/SPECS/heimdall.spec
echo "/usr/bin/heimdallcli" >> packaging/rpm/SPECS/heimdall.spec
- name: construct rpm package
run: |
rpmbuild --define "_topdir /home/runner/work/heimdall/heimdall/packaging/rpm_build" \
--define "_builddir %{_topdir}/BUILD" \
--define "_rpmdir %{_topdir}/RPMS" \
--define "_srcrpmdir %{_topdir}/SRPMS" \
--define "__spec_install_post /bin/true" \
-bb packaging/rpm/SPECS/heimdall.spec
- name: rename packages due to rpm dist rules
run: mv /home/runner/work/heimdall/heimdall/packaging/rpm_build/RPMS/aarch64/heimdall-${{ env.GIT_TAG1 }}-1.aarch64.rpm /home/runner/work/heimdall/heimdall/packaging/rpm_build/RPMS/aarch64/heimdall-${{ env.GIT_TAG1 }}.aarch64.rpm
- name: shasum a package
run: shasum /home/runner/work/heimdall/heimdall/packaging/rpm_build/RPMS/aarch64/heimdall-${{ env.GIT_TAG1 }}.aarch64.rpm > /home/runner/work/heimdall/heimdall/packaging/rpm_build/RPMS/aarch64/heimdall-${{ env.GIT_TAG1 }}.aarch64.rpm.checksum
- name: Release heimdall Packages
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.GIT_TAG }}
prerelease: true
files: |
packaging/rpm_build/RPMS/aarch64/heimdall-**.rpm
packaging/rpm_build/RPMS/aarch64/heimdall-**.rpm.checksum