Skip to content

Commit

Permalink
github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
billyb2 committed Oct 12, 2024
1 parent ecb856a commit d457c98
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Dockerfile.android
app.apk
.direnv/
.github/
.secrets
app.tar.xz
flake.nix
flake.lock
33 changes: 33 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build Android Docker Image and Upload Artifacts

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Depot CLI
uses: depot/setup-action@v1

- run: depot build --project 0k8767spqx --load --tag build -f Dockerfile .
env:
DEPOT_TOKEN: ${{ secrets.DEPOT_TOKEN }}

- name: Create artifact directory
run: mkdir -p artifacts

- name: Copy artifacts from container
run: docker create build:latest --name extract && docker cp extract:/out .

- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: output
path: out/
43 changes: 43 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
FROM golang:bookworm AS builder-android
WORKDIR /build

RUN apt update
RUN apt-get install curl unzip -y

RUN curl -LO https://dl.google.com/android/repository/android-ndk-r27b-linux.zip && unzip android-ndk-r27b-linux.zip
ENV ANDROID_NDK_HOME=/build/android-ndk-r27b/

RUN apt-get install golang gcc gcc-mingw-w64 -y
RUN go install fyne.io/fyne/v2/cmd/fyne@latest

COPY go.mod go.sum main.go Icon.png .
COPY helper ./helper
COPY pages ./pages
COPY preferences ./preferences
COPY resources ./resources
COPY state ./state

RUN fyne package --target android -appID io.bbfs.app -icon Icon.png --release



FROM golang:alpine AS builder-linux
WORKDIR /build

RUN apk add go gcc libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev linux-headers mesa-dev xz
RUN go install fyne.io/fyne/v2/cmd/fyne@latest

COPY go.mod go.sum main.go Icon.png .
COPY helper ./helper
COPY pages ./pages
COPY preferences ./preferences
COPY resources ./resources
COPY state ./state

RUN fyne package --target linux -appID io.bbfs.app -icon Icon.png --release && mv app.tar.xz app_linux.tar.xz


FROM scratch
WORKDIR /out
COPY --from=builder-android /build/app.apk .
COPY --from=builder-linux /build/app_linux.tar.xz .
1 change: 1 addition & 0 deletions depot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"id":"0k8767spqx"}

0 comments on commit d457c98

Please sign in to comment.