Update select dep version #404
Workflow file for this run
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: release | |
on: | |
push: | |
tags: | |
- 'v*.*.*' | |
branches: | |
- main | |
env: | |
APP_NAME: 'manticore-buddy' | |
MAINTAINER: 'Manticore' | |
DESC: 'Manticore Buddy' | |
LIBCURL_NAME: 'libcurl' | |
LIBCURL_VERSION: '7.29.0' | |
jobs: | |
build-artifact: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Prepare release directory | |
run: | | |
git clone https://github.com/manticoresoftware/phar_builder.git | |
./phar_builder/bin/build --name="Manticore Buddy" --package="${{ env.APP_NAME }}" | |
- id: vars | |
run: | | |
echo "app_version=$(<APP_VERSION)" >> $GITHUB_OUTPUT | |
echo "rpm_suffix=_$( date +%y%m%d%H ).${GITHUB_SHA:0:7}" >> $GITHUB_OUTPUT | |
echo "deb_suffix=-$( date +%y%m%d%H )-${GITHUB_SHA:0:7}" >> $GITHUB_OUTPUT | |
- name: Create artifact | |
run: | | |
name="${{ env.APP_NAME }}_${{ steps.vars.outputs.app_version }}${{ steps.vars.outputs.rpm_suffix }}" | |
echo "$name" | |
mkdir build/bin | |
cp build/${{ env.APP_NAME }} build/bin/${{ env.APP_NAME }} | |
tar czf "$name.tar.gz" -C build bin/${{ env.APP_NAME }} share | |
cd build | |
zip -r "$name.zip" share/modules | |
mv "$name.zip" .. | |
cd .. | |
shell: bash | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: artifact | |
path: | | |
./*.tar.gz | |
./*.zip | |
build-linux-packages: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build binary | |
run: | | |
git clone https://github.com/manticoresoftware/phar_builder.git | |
./phar_builder/bin/build --name="Manticore Buddy" --package="${{ env.APP_NAME }}" | |
- id: vars | |
run: | | |
echo "app_version=$(<APP_VERSION)" >> $GITHUB_OUTPUT | |
echo "rpm_suffix=_$( date +%y%m%d%H ).${GITHUB_SHA:0:7}" >> $GITHUB_OUTPUT | |
echo "deb_suffix=-$( date +%y%m%d%H )-${GITHUB_SHA:0:7}" >> $GITHUB_OUTPUT | |
- name: Prepare packages structure | |
run: | | |
mkdir -p .debpkg/usr/share/manticore/modules/${{ env.APP_NAME }}/bin | |
mkdir -p .rpmpkg/usr/share/manticore/modules/${{ env.APP_NAME }}/bin | |
cp -rp build/share/modules/${{ env.APP_NAME }}/* .debpkg/usr/share/manticore/modules/${{ env.APP_NAME }}/ | |
cp -rp build/share/modules/${{ env.APP_NAME }}/* .rpmpkg/usr/share/manticore/modules/${{ env.APP_NAME }}/ | |
cp -r build/${{ env.APP_NAME }} .debpkg/usr/share/manticore/modules/${{ env.APP_NAME }}/bin/${{ env.APP_NAME }} | |
cp -r build/${{ env.APP_NAME }} .rpmpkg/usr/share/manticore/modules/${{ env.APP_NAME }}/bin/${{ env.APP_NAME }} | |
- uses: manticoresoftware/actions-build-deb-action@master | |
name: Build DEB packages | |
with: | |
package: ${{ env.APP_NAME }} | |
package_root: .debpkg | |
maintainer: ${{ env.MAINTAINER }} | |
version: ${{ steps.vars.outputs.app_version }}${{ steps.vars.outputs.deb_suffix }} | |
arch: 'all' | |
desc: '${{ env.DESC }}' | |
depends: '${{ env.LIBCURL_NAME }}4 (>= ${{ env.LIBCURL_VERSION}})' | |
- name: Build RPM packages | |
run: | | |
sudo apt-get update -y -q | |
sudo apt-get install -y rpm | |
RPMBUILD_DIR="$HOME/rpmbuild" | |
RPMBUILD_SOURCE_DIR="$RPMBUILD_DIR/SOURCES" | |
RPMBUILD_SPEC_DIR="$RPMBUILD_DIR/SPECS" | |
WORKDIR="/tmp/work" | |
mkdir "$WORKDIR" | |
spec_file=rpm.spec | |
cp "packages/$spec_file" "$WORKDIR" | |
cp -rp ".rpmpkg" "$WORKDIR/${{ env.APP_NAME }}" | |
cd "$WORKDIR" | |
# Prepare spec file for RPM | |
sed -i 's/{{ NAME }}/${{ env.APP_NAME }}/g' $spec_file | |
sed -i 's/{{ VERSION }}/${{ steps.vars.outputs.app_version }}${{ steps.vars.outputs.rpm_suffix }}/g' $spec_file | |
sed -i 's/{{ MAINTAINER }}/${{ env.MAINTAINER }}/g' $spec_file | |
sed -i 's/{{ DESC }}/${{ env.DESC }}/g' $spec_file | |
sed -i 's/{{ LIBCURL_NAME }}/${{ env.LIBCURL_NAME }}/g' $spec_file | |
sed -i 's/{{ LIBCURL_VERSION }}/v${{ env.LIBCURL_VERSION }}/g' $spec_file | |
tar czf tmp.tar.gz "${{ env.APP_NAME }}/" | |
mkdir -p "$RPMBUILD_SOURCE_DIR" | |
mkdir -p "$RPMBUILD_SPEC_DIR" | |
mv tmp.tar.gz "$RPMBUILD_SOURCE_DIR" | |
cp -p $spec_file "$RPMBUILD_SPEC_DIR" | |
rpmbuild -bb "$RPMBUILD_SPEC_DIR/$spec_file" | |
ls -lah "$RPMBUILD_DIR/RPMS/noarch"/*.rpm | |
cp -p "$RPMBUILD_DIR/RPMS/noarch"/*.rpm $GITHUB_WORKSPACE | |
- name: Rename packages to proper name | |
run: | | |
ls -la ./*.rpm | |
version=${{ steps.vars.outputs.app_version }}${{ steps.vars.outputs.rpm_suffix }} | |
rpm_path="./${{ env.APP_NAME }}-${version}-1.noarch.rpm" | |
cp $rpm_path "./${{ env.APP_NAME }}-${version}-1.el7.noarch.rpm" | |
cp $rpm_path "./${{ env.APP_NAME }}-${version}-1.el8.noarch.rpm" | |
cp $rpm_path "./${{ env.APP_NAME }}-${version}-1.el9.noarch.rpm" | |
ls -la ./*.deb | |
version=${{ steps.vars.outputs.app_version }}${{ steps.vars.outputs.deb_version }} | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: artifact-deb | |
path: | | |
./*_all.deb | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: artifact-rpm | |
path: | | |
./*.noarch.rpm | |
!./*-debuginfo-*.rpm | |
create-release: | |
runs-on: ubuntu-22.04 | |
needs: | |
- build-artifact | |
- build-linux-packages | |
if: startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Generate changelog | |
run: | | |
bin/git-changelog > ./changelog | |
- name: Create Release | |
id: create-release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
body_path: ./changelog | |
draft: true | |
prerelease: false | |
deploy: | |
needs: | |
- build-artifact | |
- build-linux-packages | |
runs-on: self-hosted | |
strategy: | |
matrix: | |
include: | |
- artifact: artifact-deb | |
ext: deb | |
script: upload_repo_deb | |
mask: "" | |
delimiter: "-" | |
distro: buster | |
- artifact: artifact-deb | |
ext: deb | |
script: upload_repo_deb | |
mask: "" | |
delimiter: "-" | |
distro: bionic | |
- artifact: artifact-deb | |
ext: deb | |
script: upload_repo_deb | |
mask: "" | |
delimiter: "-" | |
distro: focal | |
- artifact: artifact-deb | |
ext: deb | |
script: upload_repo_deb | |
mask: "" | |
delimiter: "-" | |
distro: jammy | |
- artifact: artifact-deb | |
ext: deb | |
script: upload_repo_deb | |
mask: "" | |
delimiter: "-" | |
distro: bullseye | |
- artifact: artifact-deb | |
ext: deb | |
script: upload_repo_deb | |
mask: "" | |
delimiter: "-" | |
distro: bookworm | |
- artifact: artifact-rpm | |
ext: rpm | |
script: upload_repo_rpm | |
mask: "*.el7.{x86_64,aarch64,noarch}.rpm" | |
delimiter: "_" | |
distro: 7 | |
- artifact: artifact-rpm | |
ext: rpm | |
script: upload_repo_rpm | |
mask: "*.el8.{x86_64,aarch64,noarch}.rpm" | |
delimiter: "_" | |
distro: 8 | |
- artifact: artifact-rpm | |
ext: rpm | |
script: upload_repo_rpm | |
mask: "*.el9.{x86_64,aarch64,noarch}.rpm" | |
delimiter: "_" | |
distro: 9 | |
- artifact: artifact | |
ext: "{tar.gz,zip}" | |
script: upload_repo_arc | |
delimiter: "_" | |
distro: "" | |
steps: | |
- uses: actions/checkout@v3 | |
- run: mkdir build | |
- uses: actions/download-artifact@v3 | |
with: | |
name: ${{ matrix.artifact }} | |
path: ./build | |
- id: vars | |
run: | | |
echo "asset_name=$(ls ./build/*.${{ matrix.ext }} | head -n 1)" >> $GITHUB_OUTPUT | |
- name: Deploy package | |
run: | | |
curl -sSL https://raw.githubusercontent.com/manticoresoftware/repo_scripts/main/${{ matrix.script }} > ${{ matrix.script }} | |
chmod +x ${{ matrix.script }} | |
DISTRO=${{ matrix.distro }} DIGIT_DELIMITER2="${{ matrix.delimiter }}" FILE_MASK="${{ matrix.mask }}" ./${{ matrix.script }} | |
shell: bash |