Merge pull request #70 from lbr38/devel #41
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
on: | |
push: | |
branches: [ main ] | |
name: Create linupdate release | |
jobs: | |
build-deb: | |
name: Build deb package | |
runs-on: ubuntu-latest | |
container: | |
image: debian:latest | |
options: --user root | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get linupdate version | |
run: echo "VERSION=$(cat ${GITHUB_WORKSPACE}/version)" >> $GITHUB_ENV | |
- name: Install dependencies packages | |
run: apt-get update && apt-get install build-essential binutils lintian debhelper dh-make devscripts -y | |
- name: Create build environment | |
run: | | |
mkdir -p /tmp/linupdate-build/DEBIAN | |
mkdir -p /tmp/linupdate-build/etc/linupdate/modules | |
mkdir -p /tmp/linupdate-build/opt/linupdate | |
mkdir -p /tmp/linupdate-build/opt/linupdate/src/ | |
mkdir -p /tmp/linupdate-build/opt/linupdate/templates/ | |
mkdir -p /tmp/linupdate-build/lib/systemd/system/ | |
- name: Copy files to include in the build | |
run: | | |
cp -r ${GITHUB_WORKSPACE}/src/* /tmp/linupdate-build/opt/linupdate/src/ | |
cp -r ${GITHUB_WORKSPACE}/templates/* /tmp/linupdate-build/opt/linupdate/templates/ | |
cp ${GITHUB_WORKSPACE}/linupdate.py /tmp/linupdate-build/opt/linupdate/linupdate.py | |
cp ${GITHUB_WORKSPACE}/service.py /tmp/linupdate-build/opt/linupdate/service.py | |
cp ${GITHUB_WORKSPACE}/version /tmp/linupdate-build/opt/linupdate/version | |
cp -r ${GITHUB_WORKSPACE}/service/linupdate.systemd.template /tmp/linupdate-build/lib/systemd/system/linupdate.service | |
- name: Copy control file | |
run: | | |
cp ${GITHUB_WORKSPACE}/.github/workflows/packaging/deb/control /tmp/linupdate-build/DEBIAN/control | |
sed -i "s/__VERSION__/${{ env.VERSION }}/g" /tmp/linupdate-build/DEBIAN/control | |
- name: Copy preinst and postinst script | |
run: | | |
cp ${GITHUB_WORKSPACE}/.github/workflows/packaging/deb/preinst /tmp/linupdate-build/DEBIAN/preinst | |
cp ${GITHUB_WORKSPACE}/.github/workflows/packaging/deb/postinst /tmp/linupdate-build/DEBIAN/postinst | |
chmod 755 /tmp/linupdate-build/DEBIAN/preinst /tmp/linupdate-build/DEBIAN/postinst | |
- name: Build package | |
run: | | |
cd /tmp | |
dpkg-deb --build linupdate-build | |
mv /tmp/linupdate-build.deb /tmp/linupdate_${{ env.VERSION }}_all.deb | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: linupdate_${{ env.VERSION }}_all.deb | |
path: /tmp/linupdate_${{ env.VERSION }}_all.deb | |
retention-days: 3 | |
build-rpm: | |
name: Build rpm package | |
runs-on: ubuntu-latest | |
container: | |
image: centos:8 | |
options: --user root | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get linupdate version | |
run: echo "VERSION=$(cat ${GITHUB_WORKSPACE}/version)" >> $GITHUB_ENV | |
- name: Install CentOS8 archive repositories | |
run: | | |
rm /etc/yum.repos.d/* -f | |
echo "[os] | |
name=os repo | |
baseurl=https://vault.centos.org/8-stream/BaseOS/x86_64/os/ | |
enabled=1 | |
gpgkey=https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official-SHA256 | |
gpgcheck=1" > /etc/yum.repos.d/os.repo | |
echo "[appstream] | |
name=updates repo | |
baseurl=https://vault.centos.org/8-stream/AppStream/x86_64/os/ | |
enabled=1 | |
gpgkey=https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official-SHA256 | |
gpgcheck=1" > /etc/yum.repos.d/appstream.repo | |
echo "[extras] | |
name=extras repo | |
baseurl=https://vault.centos.org/8-stream/extras/x86_64/extras-common/ | |
enabled=1 | |
gpgkey=https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official-SHA256 | |
gpgcheck=1" > /etc/yum.repos.d/extras.repo | |
dnf clean all | |
- name: Install dependencies packages | |
run: yum install rpmdevtools rpmlint -y | |
- name: Create build environment | |
run: | | |
mkdir -p $HOME/rpmbuild/BUILD | |
mkdir -p $HOME/rpmbuild/BUILDROOT | |
mkdir -p $HOME/rpmbuild/RPMS | |
mkdir -p $HOME/rpmbuild/SOURCES | |
mkdir -p $HOME/rpmbuild/SPECS | |
mkdir -p /etc/linupdate/modules | |
mkdir -p /opt/linupdate | |
mkdir -p /opt/linupdate/src/ | |
mkdir -p /opt/linupdate/templates/ | |
mkdir -p /lib/systemd/system/ | |
- name: Copy files to include in the build | |
run: | | |
cp -r ${GITHUB_WORKSPACE}/src/* /opt/linupdate/src/ | |
cp -r ${GITHUB_WORKSPACE}/templates/* /opt/linupdate/templates/ | |
cp ${GITHUB_WORKSPACE}/linupdate.py /opt/linupdate/linupdate.py | |
cp ${GITHUB_WORKSPACE}/service.py /opt/linupdate/service.py | |
cp ${GITHUB_WORKSPACE}/version /opt/linupdate/version | |
cp -r ${GITHUB_WORKSPACE}/service/linupdate.systemd.template /lib/systemd/system/linupdate.service | |
- name: Copy spec file | |
run: | | |
cp ${GITHUB_WORKSPACE}/.github/workflows/packaging/rpm/spec $HOME/rpmbuild/SPECS/linupdate.spec | |
sed -i "s/__VERSION__/${{ env.VERSION }}/g" $HOME/rpmbuild/SPECS/linupdate.spec | |
- name: Build package | |
run: | | |
cd $HOME/rpmbuild/SPECS | |
rpmbuild --target noarch -bb --quiet linupdate.spec | |
mv $HOME/rpmbuild/RPMS/noarch/linupdate-${{ env.VERSION }}-stable.noarch.rpm /tmp/linupdate-${{ env.VERSION }}.noarch.rpm | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: linupdate-${{ env.VERSION }}.noarch.rpm | |
path: /tmp/linupdate-${{ env.VERSION }}.noarch.rpm | |
retention-days: 3 | |
release: | |
name: Create Release | |
needs: | |
- build-deb | |
- build-rpm | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Get linupdate version | |
run: echo "VERSION=$(cat ${GITHUB_WORKSPACE}/version)" >> $GITHUB_ENV | |
# Download builded deb package artifact | |
- name: Download deb artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: linupdate_${{ env.VERSION }}_all.deb | |
path: ~/assets | |
# Download builded rpm package artifact | |
- name: Download rpm artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: linupdate-${{ env.VERSION }}.noarch.rpm | |
path: ~/assets | |
# Create a new release | |
# - name: Create Release | |
# id: create_release | |
# uses: actions/create-release@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# with: | |
# tag_name: ${{ env.VERSION }} | |
# release_name: ${{ env.VERSION }} | |
# body: | | |
# **Changes:** | |
# - Another apt cache cleaning | |
# draft: false | |
# prerelease: false | |
# Upload packages to release | |
# - name: Upload packages | |
# id: upload-release-assets | |
# uses: dwenegar/upload-release-assets@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# with: | |
# release_id: ${{ steps.create_release.outputs.id }} | |
# assets_path: ~/assets | |
# Upload package to repository | |
- name: Upload packages to repositories | |
run: | | |
curl --fail-with-body -L --post301 -s -q -X POST -H "Authorization: Bearer ${{ secrets.REPOSITORY_TOKEN }}" -F files=@~/assets/linupdate_${{ env.VERSION }}_all.deb https://packages.bespin.ovh/api/v2/snapshot/64/upload | |
# curl --fail-with-body -L --post301 -s -q -X POST -H "Authorization: Bearer ${{ secrets.REPOSITORY_TOKEN }}" -F files=@~/assets/linupdate_${{ env.VERSION }}_all.deb https://packages.bespin.ovh/api/v2/snapshot/66/upload | |
# curl --fail-with-body -L --post301 -s -q -X POST -H "Authorization: Bearer ${{ secrets.REPOSITORY_TOKEN }}" -F files=@~/assets/linupdate_${{ env.VERSION }}_all.deb https://packages.bespin.ovh/api/v2/snapshot/68/upload | |
# curl --fail-with-body -L --post301 -s -q -X POST -H "Authorization: Bearer ${{ secrets.REPOSITORY_TOKEN }}" -F files=@~/assets/linupdate_${{ env.VERSION }}_all.deb https://packages.bespin.ovh/api/v2/snapshot/73/upload | |
# curl --fail-with-body -L --post301 -s -q -X POST -H "Authorization: Bearer ${{ secrets.REPOSITORY_TOKEN }}" -F files=@~/assets/linupdate-${{ env.VERSION }}.noarch.rpm https://packages.bespin.ovh/api/v2/snapshot/70/upload | |
# curl --fail-with-body -L --post301 -s -q -X POST -H "Authorization: Bearer ${{ secrets.REPOSITORY_TOKEN }}" -F files=@~/assets/linupdate-${{ env.VERSION }}.noarch.rpm https://packages.bespin.ovh/api/v2/snapshot/71/upload | |
# Rebuild repositories metadata | |
# - name: Rebuild repositories | |
# run: | | |
# curl --fail-with-body -X PUT -H "Authorization: Bearer ${{ secrets.REPOSITORY_TOKEN }}" -d '{"gpgSign":"true"}' https://packages.bespin.ovh/api/v2/snapshot/64/rebuild | |
# curl --fail-with-body -X PUT -H "Authorization: Bearer ${{ secrets.REPOSITORY_TOKEN }}" -d '{"gpgSign":"true"}' https://packages.bespin.ovh/api/v2/snapshot/66/rebuild | |
# curl --fail-with-body -X PUT -H "Authorization: Bearer ${{ secrets.REPOSITORY_TOKEN }}" -d '{"gpgSign":"true"}' https://packages.bespin.ovh/api/v2/snapshot/68/rebuild | |
# curl --fail-with-body -X PUT -H "Authorization: Bearer ${{ secrets.REPOSITORY_TOKEN }}" -d '{"gpgSign":"true"}' https://packages.bespin.ovh/api/v2/snapshot/73/rebuild | |
# curl --fail-with-body -X PUT -H "Authorization: Bearer ${{ secrets.REPOSITORY_TOKEN }}" -d '{"gpgSign":"true"}' https://packages.bespin.ovh/api/v2/snapshot/70/rebuild | |
# curl --fail-with-body -X PUT -H "Authorization: Bearer ${{ secrets.REPOSITORY_TOKEN }}" -d '{"gpgSign":"true"}' https://packages.bespin.ovh/api/v2/snapshot/71/rebuild |