Adding gitea build scripts for Android, Linux GUI and dockerized website
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
name: Build Android Apk
|
||||
|
||||
# Only a release built through "Releases -> New Release" starts a build. A tag
|
||||
# pushed with plain git does not publish a release and is therefore ignored.
|
||||
on:
|
||||
release:
|
||||
types:
|
||||
- published
|
||||
|
||||
env:
|
||||
# Keep in sync with the other workflows and with `ac_web/Dockerfile`.
|
||||
FLUTTER_VERSION: '3.44.9'
|
||||
# The project produces java 17 bytecode (`android/app/build.gradle.kts`), but
|
||||
# gradle 9.1 and the android gradle plugin 9 need a newer jdk to run on.
|
||||
JAVA_VERSION: '21'
|
||||
|
||||
jobs:
|
||||
android:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: catthehacker/ubuntu:act-latest
|
||||
|
||||
# The flutter project lives in a sub directory of the repository.
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ac_web
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://github.com/actions/checkout@v4
|
||||
|
||||
# The flutter tool runs git inside the workspace, which the container
|
||||
# user does not own after the checkout.
|
||||
- name: Trust the workspace
|
||||
run: git config --global --add safe.directory '*'
|
||||
|
||||
- name: Set up Java
|
||||
uses: https://github.com/actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: ${{ env.JAVA_VERSION }}
|
||||
|
||||
# Installs the command line tools and accepts the sdk licenses. The
|
||||
# platform, the build tools and the ndk pinned by the flutter sdk are
|
||||
# then downloaded by gradle itself, which is what makes this job slow on
|
||||
# a cold runner.
|
||||
- name: Set up the Android sdk
|
||||
uses: https://github.com/android-actions/setup-android@v3
|
||||
|
||||
- name: Set up Flutter
|
||||
uses: https://github.com/subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version: ${{ env.FLUTTER_VERSION }}
|
||||
channel: stable
|
||||
cache: true
|
||||
|
||||
- name: Install dependencies
|
||||
run: flutter pub get
|
||||
|
||||
- name: Run tests
|
||||
run: flutter test
|
||||
|
||||
# One apk for all abis. `--split-per-abi` would produce three smaller
|
||||
# ones instead, at the cost of having to pick the right one manually.
|
||||
#
|
||||
# The release build is signed with a debug key, because
|
||||
# `android/app/build.gradle.kts` has no release signing config yet. To
|
||||
# ship the apk, add a keystore as a secret, write it into
|
||||
# `android/key.properties` here and reference it from the gradle file.
|
||||
- name: Build the apk
|
||||
run: flutter build apk --release
|
||||
|
||||
# Gradle always writes the same file name, so the release the apk belongs
|
||||
# to would not be visible after downloading it.
|
||||
- name: Name the apk after the release
|
||||
run: mv build/app/outputs/flutter-apk/app-release.apk ac_web-${{ github.ref_name }}.apk
|
||||
|
||||
# Artifacts of v4 need gitea 1.22 or newer, older instances need @v3.
|
||||
- name: Upload the apk
|
||||
uses: https://github.com/actions/upload-artifact@v4
|
||||
with:
|
||||
name: ac_web-android-${{ github.ref_name }}
|
||||
# Artifact paths are relative to the repository, not to the
|
||||
# working-directory above.
|
||||
path: ac_web/ac_web-${{ github.ref_name }}.apk
|
||||
if-no-files-found: error
|
||||
@@ -0,0 +1,75 @@
|
||||
name: Build Linux Application
|
||||
|
||||
# Only a release built through "Releases -> New Release" starts a build. A tag
|
||||
# pushed with plain git does not publish a release and is therefore ignored.
|
||||
on:
|
||||
release:
|
||||
types:
|
||||
- published
|
||||
|
||||
env:
|
||||
# Keep in sync with the other workflows and with `ac_web/Dockerfile`.
|
||||
FLUTTER_VERSION: '3.44.9'
|
||||
|
||||
jobs:
|
||||
linux:
|
||||
runs-on: ubuntu-latest
|
||||
# Same base image as the docker job, it already brings the tools the
|
||||
# actions below expect (git, curl, unzip, node).
|
||||
container:
|
||||
image: catthehacker/ubuntu:act-latest
|
||||
|
||||
# The flutter project lives in a sub directory of the repository.
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ac_web
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://github.com/actions/checkout@v4
|
||||
|
||||
# The flutter tool runs git inside the workspace, which the container
|
||||
# user does not own after the checkout.
|
||||
- name: Trust the workspace
|
||||
run: git config --global --add safe.directory '*'
|
||||
|
||||
# Everything `flutter build linux` needs to compile the gtk runner.
|
||||
- name: Install the linux desktop toolchain
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y --no-install-recommends \
|
||||
clang cmake ninja-build pkg-config \
|
||||
libgtk-3-dev liblzma-dev libstdc++-12-dev \
|
||||
curl unzip xz-utils
|
||||
|
||||
- name: Set up Flutter
|
||||
uses: https://github.com/subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version: ${{ env.FLUTTER_VERSION }}
|
||||
channel: stable
|
||||
cache: true
|
||||
|
||||
- name: Install dependencies
|
||||
run: flutter pub get
|
||||
|
||||
- name: Run tests
|
||||
run: flutter test
|
||||
|
||||
- name: Build the linux application
|
||||
run: flutter build linux --release
|
||||
|
||||
# The build produces a directory, not a single file: the executable next
|
||||
# to the flutter engine and its data. It is packed so that the artifact
|
||||
# keeps the executable bit.
|
||||
- name: Pack the bundle
|
||||
run: tar -czf ac_web-linux-x64-${{ github.ref_name }}.tar.gz -C build/linux/x64/release bundle
|
||||
|
||||
# Artifacts of v4 need gitea 1.22 or newer, older instances need @v3.
|
||||
- name: Upload the bundle
|
||||
uses: https://github.com/actions/upload-artifact@v4
|
||||
with:
|
||||
name: ac_web-linux-x64-${{ github.ref_name }}
|
||||
# Artifact paths are relative to the repository, not to the
|
||||
# working-directory above.
|
||||
path: ac_web/ac_web-linux-x64-${{ github.ref_name }}.tar.gz
|
||||
if-no-files-found: error
|
||||
@@ -0,0 +1,66 @@
|
||||
name: Publish Docker Image
|
||||
|
||||
# Only a release built through "Releases -> New Release" starts a build. A tag
|
||||
# pushed with plain git does not publish a release and is therefore ignored.
|
||||
on:
|
||||
release:
|
||||
types:
|
||||
- published
|
||||
|
||||
env:
|
||||
# Gitea container registry. Set a different host in
|
||||
# "Settings -> Actions -> Variables" if the instance ever moves.
|
||||
REGISTRY: git.srv.kingeldarion.de
|
||||
OWNER: ${{ github.repository_owner }}
|
||||
IMAGE: ac-web
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
# This base image makes Docker-in-Docker with Gitea's act-runner painless.
|
||||
container:
|
||||
image: catthehacker/ubuntu:act-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://github.com/actions/checkout@v4
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: https://github.com/docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Buildx
|
||||
uses: https://github.com/docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Gitea Container Registry
|
||||
uses: https://github.com/docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.repository_owner }}
|
||||
# A personal access token, created in the repo settings as BUILDTOKEN.
|
||||
password: ${{ secrets.BUILDTOKEN }}
|
||||
|
||||
- name: Docker meta (tags & labels)
|
||||
id: meta
|
||||
uses: https://github.com/docker/metadata-action@v5
|
||||
with:
|
||||
images: |
|
||||
${{ env.REGISTRY }}/${{ env.OWNER }}/${{ env.IMAGE }}
|
||||
# Only releases end up here, so every build is the newest one and
|
||||
# branch tags can never occur. Move `latest` behind a condition on
|
||||
# `github.event.release.prerelease` if pre-releases are used.
|
||||
tags: |
|
||||
type=raw,value=latest
|
||||
type=ref,event=tag
|
||||
type=sha,format=short
|
||||
|
||||
# The dockerfile compiles the web bundle itself, so the context is the
|
||||
# flutter project and nothing has to be built before this step.
|
||||
- name: Build & Push the website image
|
||||
uses: https://github.com/docker/build-push-action@v5
|
||||
with:
|
||||
context: ./ac_web
|
||||
file: ./ac_web/Dockerfile
|
||||
push: true
|
||||
platforms: linux/amd64
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
Reference in New Issue
Block a user