# Builds, signs and publishes the Fennec OS packages (shell + apps) to the # Gitea generic package registry. A package is only built when its version # isn't published yet: bump the version to release (docs/updates.md). # # Runner hygiene (shared host, little disk): runs in the runner image that is # already on the host (no image pull), uses no `uses:` actions (no action # cache), and deletes everything it made at the end. name: packages on: push: branches: [main] paths: - "crates/**" - "apps/**" - "Cargo.toml" - "Cargo.lock" - "tools/pkg/**" - "tools/siri-remote/fastpair.py" - ".gitea/workflows/packages.yml" workflow_dispatch: jobs: packages: runs-on: build container: image: docker.gitea.com/runner-images:ubuntu-latest env: CARGO_HOME: /tmp/sf-build/cargo RUSTUP_HOME: /tmp/sf-build/rustup CARGO_TARGET_DIR: /tmp/sf-build/target CARGO_INCREMENTAL: "0" SF_OUT: /tmp/sf-build/out steps: - name: Checkout run: | mkdir -p /tmp/sf-build host="${GITHUB_SERVER_URL#https://}" git clone --depth 1 --branch "${GITHUB_REF_NAME}" \ "https://oauth2:${{ secrets.GITHUB_TOKEN }}@${host}/${GITHUB_REPOSITORY}.git" /tmp/sf-build/src - name: Toolchain run: | export DEBIAN_FRONTEND=noninteractive # arm64 libraries for the Raspberry Pi shell (SF_TARGET=aarch64-...): # Ubuntu serves them from ports.ubuntu.com, the main mirror is amd64 only. . /etc/os-release dpkg --add-architecture arm64 if [ -f /etc/apt/sources.list.d/ubuntu.sources ]; then sed -i '/^Architectures:/d; /^Types:/a Architectures: amd64' /etc/apt/sources.list.d/ubuntu.sources fi [ -f /etc/apt/sources.list ] && sed -i 's/^deb \(http\)/deb [arch=amd64] \1/' /etc/apt/sources.list printf 'Types: deb\nURIs: http://ports.ubuntu.com/ubuntu-ports/\nSuites: %s %s-updates %s-security\nComponents: main universe\nArchitectures: arm64\nSigned-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg\n' \ "$VERSION_CODENAME" "$VERSION_CODENAME" "$VERSION_CODENAME" >/etc/apt/sources.list.d/arm64-ports.sources apt-get update -qq libs="libfontconfig1-dev libfreetype-dev libxkbcommon-dev libdbus-1-dev libudev-dev libinput-dev libgbm-dev libseat-dev libdrm-dev libegl-dev" # qemu-user-static: libglib2.0-dev:arm64 (via libinput-dev) wants # "python3 | qemu-user-static"; python3:arm64 can't be set up on amd64. apt-get install -y -qq --no-install-recommends build-essential pkg-config zstd \ gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libc6-dev-arm64-cross qemu-user-static \ $libs >/dev/null # The amd64 and arm64 libgudev-1.0-dev ship differing GUdev-1.0.gir # files; this throwaway container keeps either. apt-get install -y -qq --no-install-recommends -o Dpkg::Options::=--force-overwrite \ $(for l in $libs; do printf '%s:arm64 ' "$l"; done) >/dev/null rm -rf /var/lib/apt/lists/* curl -sSf https://sh.rustup.rs | sh -s -- -y -q --profile minimal --no-modify-path --target aarch64-unknown-linux-gnu /tmp/sf-build/cargo/bin/rustc --version - name: Build, sign, upload env: SF_SIGNING_KEY: ${{ secrets.SF_SIGNING_KEY }} SF_PACKAGE_TOKEN: ${{ secrets.SF_PACKAGE_TOKEN }} run: | export PATH="/tmp/sf-build/cargo/bin:$PATH" cd /tmp/sf-build/src bash tools/pkg/packages.sh --upload # The shell for the Raspberry Pi (sf-shell--aarch64; apps are the same). SF_TARGET=aarch64-unknown-linux-gnu bash tools/pkg/packages.sh --upload shell - name: Clean up if: always() run: | rm -rf /tmp/sf-build df -h / | tail -1