Skip to content

Commit

Permalink
Github action for release
Browse files Browse the repository at this point in the history
  • Loading branch information
losynix committed May 9, 2023
1 parent 3269e71 commit 573dd1d
Show file tree
Hide file tree
Showing 6 changed files with 181 additions and 41 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/usbsas_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: usbsas release

on:
push:
tags:
- "v*"

env:
CARGO_TERM_COLOR: always

jobs:
build-all:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Build packages and live ISO
run: |
cd debian && \
docker build -t usbsas-builder:debian -f Dockerfile . && \
docker run -t -u $(id -u):$(id -g) -v $(pwd)/../:/SRC \
--env CARGO_HOME=/SRC/target/.cargo usbsas-builder:debian \
make -C debian pkgs && \
docker run -t --privileged -v $(pwd)/../:/SRC \
--env CARGO_HOME=/SRC/target/.cargo usbsas-builder:debian \
make SU= -C debian
- name: Upload deb packages
uses: actions/upload-artifact@v3
with:
name: usbsas-deb-packages
path: ./target/debian/usbsas-*.deb
- name: Upload live ISO
uses: actions/upload-artifact@v3
with:
name: usbsas-live-iso
path: ./client/live-iso/usbsas-*.iso
release:
name: Github release draft
needs: [build-all]
runs-on: ubuntu-latest
steps:
- name: Download usbsas deb packages
uses: actions/download-artifact@v3
with:
name: usbsas-deb-packages
- name: Download usbsas live ISO
uses: actions/download-artifact@v3
with:
name: usbsas-live-iso
- name: Get artifacts names
id: artifacts_names
run: |
echo "U_PKG_ASRV=$(ls usbsas-analyzer-server*.deb)" >> "$GITHUB_OUTPUT" && \
echo "U_PKG_SRV=$(ls usbsas-server*.deb)" >> "$GITHUB_OUTPUT" && \
echo "U_PKG_CORE=$(ls usbsas-core*.deb)" >> "$GITHUB_OUTPUT" && \
echo "U_PKG_KIOSK=$(ls usbsas-kiosk*.deb)" >> "$GITHUB_OUTPUT" && \
echo "U_PKG_HID=$(ls usbsas-hid*.deb)" >> "$GITHUB_OUTPUT" && \
echo "U_ISO=$(ls usbsas-*.hybrid.iso)" >> "$GITHUB_OUTPUT"
- name: Create draft release
uses: softprops/action-gh-release@v1
with:
draft: true
files: |
${{ steps.artifacts_names.outputs.U_PKG_ASRV }}
${{ steps.artifacts_names.outputs.U_PKG_SRV }}
${{ steps.artifacts_names.outputs.U_PKG_CORE }}
${{ steps.artifacts_names.outputs.U_PKG_KIOSK }}
${{ steps.artifacts_names.outputs.U_PKG_HID }}
${{ steps.artifacts_names.outputs.U_ISO }}
29 changes: 14 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions client/live-iso/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.build
cache
chroot*
config/binary
config/bootstrap
config/common
config/hooks/live/0010*
config/hooks/live/0050*
config/hooks/normal
config/includes.chroot/usbsas-*.deb
config/source


31 changes: 5 additions & 26 deletions client/live-iso/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ DST_PKG_DIR=config/includes.chroot
SRC_PKG_DIR=../../target/debian

export USBSAS_ISO_VER=$(ISO_VER)
export USBSAS_BIN_PATH=/usr/libexec
export USBSAS_WEBFILES_DIR=/usr/share/usbsas/web

CORE_VER := $(shell grep '^version = ' ../../usbsas-usbsas/Cargo.toml | cut -d'"' -f2)
SRV_VER := $(shell grep '^version = ' ../../usbsas-server/Cargo.toml | cut -d'"' -f2)
ASRV_VER := $(shell grep '^version = ' ../../usbsas-analyzer-server/Cargo.toml | cut -d'"' -f2)
HID_VER := $(shell grep '^version = ' ../../usbsas-hid/hid-dealer/Cargo.toml | cut -d'"' -f2)
KIOSK_VER := $(shell grep 'Version' ../kiosk/usbsas-kiosk/DEBIAN/control | cut -d' ' -f2)

SU=sudo

all: usbsas-$(ISO_VER)-amd64.hybrid.iso

pkgs: $(DST_PKG_DIR)/usbsas-kiosk_$(KIOSK_VER)_amd64.deb \
Expand All @@ -24,34 +24,13 @@ pkgs: $(DST_PKG_DIR)/usbsas-kiosk_$(KIOSK_VER)_amd64.deb \
$(DST_PKG_DIR)/%.deb: $(SRC_PKG_DIR)/%.deb
cp $< $@

$(SRC_PKG_DIR)/usbsas-kiosk_$(KIOSK_VER)_amd64.deb:
make -C ../kiosk

$(SRC_PKG_DIR)/usbsas-core_$(CORE_VER)_amd64.deb:
cargo build --release --manifest-path=../../Cargo.toml
cargo-deb --no-build --manifest-path=../../usbsas-usbsas/Cargo.toml

$(SRC_PKG_DIR)/usbsas-server_$(SRV_VER)_amd64.deb:
cargo-deb --no-build --manifest-path=../../usbsas-server/Cargo.toml

$(SRC_PKG_DIR)/usbsas-analyzer-server_$(ASRV_VER)_amd64.deb:
cargo build --release --manifest-path=../../usbsas-analyzer-server/Cargo.toml
cargo-deb --no-build --manifest-path=../../usbsas-analyzer-server/Cargo.toml

$(SRC_PKG_DIR)/usbsas-hid_$(HID_VER)_amd64.deb:
cargo build --release --manifest-path=../../usbsas-hid/hid-user/Cargo.toml
cargo build --release --manifest-path=../../usbsas-hid/hid-dealer/Cargo.toml
cargo-deb --no-build --manifest-path=../../usbsas-hid/hid-dealer/Cargo.toml

usbsas-$(ISO_VER)-amd64.hybrid.iso: pkgs
lb config
sudo lb build
$(SU) lb build

clean:
sudo lb clean
$(SU) lb clean

distclean: clean
sudo rm -rf cache
$(SU) rm -rf cache
rm $(DST_PKG_DIR)/*.deb
make -C ../kiosk clean
cargo clean --manifest-path=../../Cargo.toml
26 changes: 26 additions & 0 deletions debian/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM rust:slim-bullseye

RUN set -eux; \
apt-get update && \
apt-get install -y --no-install-recommends \
pkgconf \
clang \
make \
cmake \
curl \
git \
protobuf-compiler \
libfuse3-dev \
libssl-dev \
libkrb5-dev \
libclamav-dev \
libx11-dev \
libxtst-dev \
libdbus-1-dev \
libudev-dev \
libseccomp-dev \
live-build \
dpkg-dev && \
cargo install cargo-deb

WORKDIR /SRC
52 changes: 52 additions & 0 deletions debian/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
ISO_VER=$(shell grep '^version' ../Cargo.toml | cut -d'"' -f2)

PKG_DIR=../target/debian

export USBSAS_ISO_VER=$(ISO_VER)
export USBSAS_BIN_PATH=/usr/libexec
export USBSAS_WEBFILES_DIR=/usr/share/usbsas/web

CORE_VER := $(shell grep '^version = ' ../usbsas-usbsas/Cargo.toml | cut -d'"' -f2)
SRV_VER := $(shell grep '^version = ' ../usbsas-server/Cargo.toml | cut -d'"' -f2)
ASRV_VER := $(shell grep '^version = ' ../usbsas-analyzer-server/Cargo.toml | cut -d'"' -f2)
HID_VER := $(shell grep '^version = ' ../usbsas-hid/hid-dealer/Cargo.toml | cut -d'"' -f2)
KIOSK_VER := $(shell grep 'Version' ../client/kiosk/usbsas-kiosk/DEBIAN/control | cut -d' ' -f2)

all: ../client/live-iso/usbsas-$(ISO_VER)-amd64.hybrid.iso

pkgs: $(PKG_DIR)/usbsas-kiosk_$(KIOSK_VER)_amd64.deb \
$(PKG_DIR)/usbsas-core_$(CORE_VER)_amd64.deb \
$(PKG_DIR)/usbsas-server_$(SRV_VER)_amd64.deb \
$(PKG_DIR)/usbsas-analyzer-server_$(ASRV_VER)_amd64.deb \
$(PKG_DIR)/usbsas-hid_$(HID_VER)_amd64.deb

$(PKG_DIR)/usbsas-kiosk_$(KIOSK_VER)_amd64.deb:
make -C ../client/kiosk

$(PKG_DIR)/usbsas-core_$(CORE_VER)_amd64.deb:
cargo build --release --manifest-path=../Cargo.toml
cargo-deb --no-build --manifest-path=../usbsas-usbsas/Cargo.toml

$(PKG_DIR)/usbsas-server_$(SRV_VER)_amd64.deb:
cargo-deb --no-build --manifest-path=../usbsas-server/Cargo.toml

$(PKG_DIR)/usbsas-analyzer-server_$(ASRV_VER)_amd64.deb:
cargo build --release --manifest-path=../usbsas-analyzer-server/Cargo.toml
cargo-deb --no-build --manifest-path=../usbsas-analyzer-server/Cargo.toml

$(PKG_DIR)/usbsas-hid_$(HID_VER)_amd64.deb:
cargo build --release --manifest-path=../usbsas-hid/hid-user/Cargo.toml
cargo build --release --manifest-path=../usbsas-hid/hid-dealer/Cargo.toml
cargo-deb --no-build --manifest-path=../usbsas-hid/hid-dealer/Cargo.toml

../client/live-iso/usbsas-$(ISO_VER)-amd64.hybrid.iso: pkgs
make -C ../client/live-iso

clean:
make -C ../client/live-iso clean
make -C ../client/kiosk clean

distclean: clean
make -C ../client/live-iso distclean
make -C ../client/kiosk distclean
cargo clean --manifest-path=../Cargo.toml

0 comments on commit 573dd1d

Please sign in to comment.