This repository has been archived by the owner on Dec 5, 2024. It is now read-only.
Build Surveillance System OS #9
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 Surveillance System OS" | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
permissions: | |
contents: write | |
pull-requests: read | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Get current date | |
id: date | |
run: echo "stamp=$(date '+%s')" >> $GITHUB_ENV | |
- name: Install tools | |
run: sudo apt update ; sudo apt -y install python-is-python3 python3-pip exfatprogs parted | |
- name: Create installer.bin | |
run: truncate -s 4G installer.bin | |
- name: Create installer.bin | |
run: sudo mknod -m 0660 /dev/loop254 b 7 254 | |
- name: Mount installer.bin as loopback device | |
run: sudo losetup -P /dev/loop254 installer.bin | |
- name: Build base installer image | |
run: sudo chmod +x create-debian-usb-key.sh && sudo ./create-debian-usb-key.sh /dev/loop254 | |
- name: Docker build | |
run: docker build -t surv:latest . | |
- name: Docker export | |
run: cd /mnt ; sudo docker save surv:latest | sudo tar -xvpf | |
- name: Add configs | |
run: sudo cpfstab /mnt/etc/ ; sudo cp issue.net /mnt/etc/issue.net ; sudo cp sshd_config /mnt/etc/ssh ; sudo cp 10-eth.network /mnt/etc/systemd/network | |
- name: Unmount | |
run: sync ; sync ; sudo umount /mnt/boot/efi ; sudo umount /mnt/home ; sudo umount /mnt | |
- name: Disconnect installer.bin | |
run: sudo losetup -D /dev/loop254 | |
- name: Move into directory | |
run: mkdir surveillance_system_os && mv installer.* surveillance_system_os/ | |
- name: Archive directory | |
run: zip -r surveillance_system_os-${{ env.stamp }}.zip surveillance_system_os | |
- name: Create GH release | |
uses: actions/create-release@v1 | |
id: create_release | |
with: | |
draft: true | |
prerelease: false | |
release_name: surveillance_system_os-${{ env.stamp }} | |
tag_name: ${{ env.stamp }} | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
- name: Upload zipped image to release artifacts | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: surveillance_system_os-${{ env.stamp }}.zip | |
asset_name: surveillance_system_os-${{ env.stamp }}.zip | |
asset_content_type: application/zip |