Skip to content

Add gh actions workflow for building rpi image #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 21 commits into
base: first-impl
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/build_rpi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Dispatched Build and publish RaspAP images

permissions:
contents: write

on:
release:
types: [published]
workflow_dispatch:
pull_request:

jobs:
build-raspap-image:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- arch: "32-bit"
pi_gen_version: "master"
- arch: "64-bit"
pi_gen_version: "arm64"
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v4

# - name: Add RaspAP Stage
# run: |
# mkdir -p stage-raspap/package-raspap &&
# {
# cat > stage-raspap/package-raspap/00-run-chroot.sh <<-EOF
# #!/bin/bash
# apt-get update -y && apt-get install -y curl dhcpcd5 iptables procps
# curl -sL https://install.raspap.com | bash -s -- --yes --openvpn 1 --restapi 1 --adblock 1 --wireguard 1 --tcp-bbr 1 --check 0

# # Set Wi-Fi country to prevent RF kill
# raspi-config nonint do_wifi_country "US"
# EOF
# } &&
# chmod +x stage-raspap/package-raspap/00-run-chroot.sh &&
# {
# cat > stage-raspap/prerun.sh <<-EOF
# #!/bin/bash -e
# if [ ! -d "\${ROOTFS_DIR}" ]; then
# copy_previous
# fi
# EOF
# } &&
# chmod +x stage-raspap/prerun.sh

- name: Build RaspAP Image
id: build
uses: usimd/pi-gen-action@v1
with:
image-name: "raspap-bookworm-${{ matrix.arch == '32-bit' && 'armhf' || 'arm64' }}-lite-${{ github.event.inputs.tag || github.ref_name }}"
enable-ssh: 1
stage-list: stage0 stage1 stage2
# stage-list: stage0 stage1 stage2 ./stage-raspap
verbose-output: true
pi-gen-version: ${{ matrix.pi_gen_version }}
pi-gen-repository: RaspAP/pi-gen

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: rpi-deploy-${{ matrix.arch }}.img.zip
path: ${{ steps.build.outputs.image-path }}
30 changes: 30 additions & 0 deletions .github/workflows/build_rpi_chroot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build Raspberry Pi image with chroot

on:
push:
branches:
- "*"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: pguyot/arm-runner-action@v2
id: build_image
with:
commands: |
echo yay

- name: Compress the release image
# if: github.ref == 'refs/heads/releng' || startsWith(github.ref, 'refs/tags/')
run: |
mv ${{ steps.build_image.outputs.image }} my-release-image.img
xz -0 -T 0 -v my-release-image.img

- name: Upload release image
uses: actions/upload-artifact@v4
# if: github.ref == 'refs/heads/releng' || startsWith(github.ref, 'refs/tags/')
with:
name: Release image
path: my-release-image.img.xz
18 changes: 17 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
FROM ubuntu:20.04
FROM python:3

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update

# RUN sed -i 's|http://ports.ubuntu.com/ubuntu-ports|http://archive.ubuntu.com/ubuntu|g' /etc/apt/sources.list && \
# apt-get update && \
# apt-get install -y curl

RUN mkdir -p /workspace/app
RUN mkdir -p /workspace/runners
RUN mkdir -p /workspace/data

RUN curl -sL -o /tmp/updatecli_amd64.deb https://github.com/updatecli/updatecli/releases/download/v0.97.0/updatecli_amd64.deb && \
dpkg -i /tmp/updatecli_amd64.deb && \
rm /tmp/updatecli_amd64.deb

RUN python3 -m pip install --user ansible
# RUN updatecli version

WORKDIR /workspace/app

COPY ./workspace/repo_config.json /workspace/repo_config.json
Expand Down
10 changes: 10 additions & 0 deletions docker/docker-compose.with_volumes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: '3'
services:
pi_with_volumes:
build:
context: .
network: none
command: ./index
platform: linux/x86_64
volumes:
- "./workspace:/workspace"
11 changes: 9 additions & 2 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
version: '3'
services:
pi:
build:
context: .
network: none
# network: none
command: ./index
# command: updatecli version
platform: linux/x86_64
environment:
WORKSPACE_DIRECTORY: '/workspace'
ASSET_NAME: 'index-linux-x64'
GITHUB_API_URL: ${GITHUB_API_URL}
# networks:
# - app-network

# volumes:
# - "./workspace:/workspace"
# networks:
# app-network:
# driver: bridge
Loading
Loading