This repository has been archived by the owner on Oct 8, 2023. It is now read-only.
CI #110
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: CI | |
on: | |
push: | |
branches: [ main ] | |
tags: [ '*' ] | |
pull_request: | |
schedule: | |
- cron: '30 2 */10 * *' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
download-packages: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y curl libxml2-utils jq | |
- name: Download packages | |
run: | | |
sudo bash downloadNessus.sh | |
- name: Upload debian packages | |
uses: actions/upload-artifact@v3 | |
with: | |
name: debian-packages | |
path: "*.deb" | |
if-no-files-found: error | |
build: | |
needs: [ download-packages ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Maximize build space | |
uses: easimon/maximize-build-space@master | |
with: | |
root-reserve-mb: 8192 | |
temp-reserve-mb: 1024 | |
swap-size-mb: 512 | |
remove-dotnet: 'true' | |
remove-android: 'true' | |
remove-haskell: 'true' | |
- uses: actions/checkout@v3 | |
- name: Set environment variables | |
run: | | |
echo REPO=$(pwd) >> ${GITHUB_ENV} | |
echo LB=$(pwd)/live-build >> ${GITHUB_ENV} | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get full-upgrade -y | |
wget https://http.kali.org/pool/main/k/kali-archive-keyring/kali-archive-keyring_2022.1_all.deb | |
wget https://http.kali.org/kali/pool/main/l/live-build/live-build_20220505_all.deb | |
sudo apt-get install -y git live-build simple-cdd debootstrap cdebootstrap curl sed | |
sudo dpkg -i kali-archive-keyring_2022.1_all.deb | |
sudo dpkg -i live-build_20220505_all.deb | |
cd /usr/share/debootstrap/scripts/ | |
(echo "default_mirror http://http.kali.org/kali"; sed -e "s/debian-archive-keyring.gpg/kali-archive-keyring.gpg/g" sid) > /tmp/kali | |
sudo mv /tmp/kali . | |
sudo rm -rf kali-rolling | |
sudo ln -s kali kali-rolling | |
- name: Create live-build directory structure | |
run: | | |
sudo git clone https://gitlab.com/kalilinux/build-scripts/live-build-config.git ${LB} | |
cd ${LB} | |
sudo lb config --distribution kali-rolling -- --variant xfce | |
sudo mkdir -p config/packages/ | |
- name: Download debian packages | |
uses: actions/download-artifact@v3 | |
with: | |
name: debian-packages | |
path: config/packages | |
- name: Adjust live-build configuration | |
run: | | |
sudo cp -vr ${REPO}/config/* ${LB}/config/ | |
# TODO not working | |
sudo sed -i -e '/append/ s/\(.*\)/\1 nozsh/' ${LB}/kali-config/common/bootloaders/syslinux_common/live.cfg.in | |
sudo chmod +x ${LB}/config/includes.chroot/etc/skel/post-install.sh | |
# make scripts that are being sourced on startup executeable (shouldn't be nessesary because they will be sourced) | |
sudo chmod +x ${LB}/config/includes.chroot/etc/live/config.conf.d/* | |
sudo patch /usr/share/live/build/functions/firmwarelists.sh ${REPO}/nvidia-fix.patch | |
- name: Building | |
working-directory: ${{ env.LB }} | |
run: | | |
sudo lb build | |
- name: Check Space | |
run: df -h | |
- name: Regain space | |
working-directory: ${{ env.LB }} | |
run: | | |
sudo mv ${LB}/live-image-amd64.hybrid.iso ${REPO}/kali-amd64.iso | |
sudo rm -rf ${LB} | |
sudo apt-get -y purge git live-build simple-cdd debootstrap cdebootstrap curl libxml2-utils jq | |
sudo apt-get -y autoremove | |
sudo apt-get -y clean | |
- name: Check Space | |
run: df -h | |
- name: Uploading ISO | |
uses: actions/upload-artifact@v3 | |
with: | |
name: kali-amd64.iso | |
path: ${{ env.REPO }}/kali-amd64.iso | |
if-no-files-found: error | |
extract: | |
needs: [ build ] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
files: | |
- live/vmlinuz | |
- live/initrd.img | |
- live/filesystem.squashfs | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: kali-amd64.iso | |
- run: mkdir tmp | |
- name: Mount ISO | |
run: | | |
sudo mount -o loop kali-amd64.iso tmp | |
echo name=$(basename ${{ matrix.files }}) >> ${GITHUB_ENV} | |
- name: Upload ${{ matrix.files }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.name }} | |
path: tmp/${{ matrix.files }} | |
if-no-files-found: error |