ci: use pre-built APK in Docker image instead of compiling from source
Build and Publish Arch Package / build-arch (amd64, x86_64) (push) Has been cancelled
Build and Publish Arch Package / build-arch (arm64, aarch64) (push) Has been cancelled
Build and Publish Docker Image / build-apk (amd64, x86_64) (push) Successful in 46s
Build and Publish Docker Image / build-apk (arm64, aarch64) (push) Successful in 51s
Build and Publish Docker Image / build-and-push-docker (push) Failing after 11m58s
Build and Publish Arch Package / build-arch (amd64, x86_64) (push) Has been cancelled
Build and Publish Arch Package / build-arch (arm64, aarch64) (push) Has been cancelled
Build and Publish Docker Image / build-apk (amd64, x86_64) (push) Successful in 46s
Build and Publish Docker Image / build-apk (arm64, aarch64) (push) Successful in 51s
Build and Publish Docker Image / build-and-push-docker (push) Failing after 11m58s
This commit is contained in:
@@ -1,68 +0,0 @@
|
||||
name: Build and Publish APK Package
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
build-apk:
|
||||
runs-on:
|
||||
- ubuntu-24.04
|
||||
container:
|
||||
image: alpine:latest
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- goarch: amd64
|
||||
pkgarch: x86_64
|
||||
- goarch: arm64
|
||||
pkgarch: aarch64
|
||||
steps:
|
||||
- name: Install build dependencies
|
||||
run: |
|
||||
apk update
|
||||
apk add --no-cache git nodejs go abuild curl sudo build-base
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Create build user
|
||||
run: |
|
||||
adduser -D -G abuild build
|
||||
echo "build ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
|
||||
chown -R build:abuild .
|
||||
|
||||
- name: Configure git safe directory
|
||||
run: git config --global --add safe.directory "$PWD"
|
||||
|
||||
- name: Setup abuild for package signing
|
||||
run: |
|
||||
su build -c "abuild-keygen -a -n"
|
||||
cp /home/build/.abuild/*.pub /etc/apk/keys/
|
||||
|
||||
- name: Prepare source
|
||||
run: |
|
||||
pkgver=$(echo "${{ github.ref_name }}" | sed 's/^v//')
|
||||
pkgname="axolotl"
|
||||
|
||||
sed -i "s/pkgver=.*/pkgver=$pkgver/" packaging/alpine/APKBUILD
|
||||
sed -i "s/^arch=.*/arch=\"${{ matrix.pkgarch }}\"/" packaging/alpine/APKBUILD
|
||||
|
||||
git archive --format=tar.gz --prefix="$pkgname-$pkgver/" -o "packaging/alpine/$pkgname-$pkgver.tar.gz" HEAD
|
||||
|
||||
sed -i "s|source=.*|source=\"\$pkgname-\$pkgver.tar.gz\"|" packaging/alpine/APKBUILD
|
||||
chown -R build:abuild .
|
||||
|
||||
- name: Generate checksums
|
||||
run: su build -c "cd $PWD/packaging/alpine && abuild checksum"
|
||||
|
||||
- name: Build package
|
||||
run: su build -c "cd $PWD/packaging/alpine && GOARCH=${{ matrix.goarch }} CARCH=${{ matrix.pkgarch }} abuild -r"
|
||||
|
||||
- name: Publish to Gitea Registry
|
||||
run: |
|
||||
apk_file=$(find ~build/packages -name "*.apk" -type f | head -1)
|
||||
curl --fail-with-body \
|
||||
--user "${{ github.repository_owner }}:${{ secrets.ACCESS_TOKEN }}" \
|
||||
--upload-file "$apk_file" \
|
||||
"${{ github.server_url }}/api/packages/${{ github.repository_owner }}/alpine/edge/main"
|
||||
@@ -1,15 +1,81 @@
|
||||
name: Build and Push Docker Container
|
||||
name: Build and Publish Docker Image
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
build-apk:
|
||||
runs-on:
|
||||
- ubuntu-24.04
|
||||
container:
|
||||
image: alpine:latest
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- goarch: amd64
|
||||
pkgarch: x86_64
|
||||
- goarch: arm64
|
||||
pkgarch: aarch64
|
||||
steps:
|
||||
- name: Install build dependencies
|
||||
run: |
|
||||
apk update
|
||||
apk add --no-cache git nodejs go abuild curl sudo build-base
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Create build user
|
||||
run: |
|
||||
adduser -D -G abuild build
|
||||
echo "build ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
|
||||
chown -R build:abuild .
|
||||
|
||||
- name: Configure git safe directory
|
||||
run: git config --global --add safe.directory "$PWD"
|
||||
|
||||
- name: Setup abuild for package signing
|
||||
run: |
|
||||
su build -c "abuild-keygen -a -n"
|
||||
cp /home/build/.abuild/*.pub /etc/apk/keys/
|
||||
|
||||
- name: Prepare source
|
||||
run: |
|
||||
pkgver=$(echo "${{ github.ref_name }}" | sed 's/^v//')
|
||||
pkgname="axolotl"
|
||||
|
||||
sed -i "s/pkgver=.*/pkgver=$pkgver/" packaging/alpine/APKBUILD
|
||||
sed -i "s/^arch=.*/arch=\"${{ matrix.pkgarch }}\"/" packaging/alpine/APKBUILD
|
||||
|
||||
git archive --format=tar.gz --prefix="$pkgname-$pkgver/" -o "packaging/alpine/$pkgname-$pkgver.tar.gz" HEAD
|
||||
|
||||
sed -i "s|source=.*|source=\"\$pkgname-\$pkgver.tar.gz\"|" packaging/alpine/APKBUILD
|
||||
chown -R build:abuild .
|
||||
|
||||
- name: Generate checksums
|
||||
run: su build -c "cd $PWD/packaging/alpine && abuild checksum"
|
||||
|
||||
- name: Build package
|
||||
run: su build -c "cd $PWD/packaging/alpine && GOARCH=${{ matrix.goarch }} CARCH=${{ matrix.pkgarch }} abuild -r"
|
||||
|
||||
- name: Publish to Gitea Registry
|
||||
run: |
|
||||
apk_file=$(find ~build/packages -name "*.apk" -type f | head -1)
|
||||
curl --fail-with-body \
|
||||
--user "${{ github.repository_owner }}:${{ secrets.ACCESS_TOKEN }}" \
|
||||
--upload-file "$apk_file" \
|
||||
"${{ github.server_url }}/api/packages/${{ github.repository_owner }}/alpine/edge/main"
|
||||
|
||||
build-and-push-docker:
|
||||
needs: build-apk
|
||||
runs-on:
|
||||
- ubuntu-24.04
|
||||
steps:
|
||||
- name: Login to Docker Hub
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Login to Docker Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: g.eliaskohout.de
|
||||
@@ -22,9 +88,18 @@ jobs:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Extract version
|
||||
id: version
|
||||
run: |
|
||||
VERSION=$(echo "${{ github.ref_name }}" | sed 's/^v//')
|
||||
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
build-args: |
|
||||
VERSION=${{ steps.version.outputs.version }}
|
||||
tags: "g.eliaskohout.de/eliaskohout/axolotl-server:${{gitea.ref_name}},g.eliaskohout.de/eliaskohout/axolotl-server:latest"
|
||||
|
||||
Reference in New Issue
Block a user