mirror of
https://github.com/itdoginfo/podkop.git
synced 2025-12-08 04:26:55 +03:00
chore: Automatic build process rewrite
* Added apk packages support * Move to matrix builds * Minor versions update for some actions just in case * Automatic release with ipk/apk packages
This commit is contained in:
118
.github/workflows/build.yml
vendored
118
.github/workflows/build.yml
vendored
@@ -4,51 +4,117 @@ on:
|
|||||||
tags:
|
tags:
|
||||||
- v*
|
- v*
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
preparation:
|
||||||
name: Build podkop and luci-app-podkop
|
name: Setup build version
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
version: ${{ steps.version.outputs.version }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4.2.1
|
- uses: actions/checkout@v5.0.0
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- id: version
|
||||||
|
run: |
|
||||||
|
VERSION=$(git describe --tags --exact-match 2>/dev/null || echo "dev_$(date +%d%m%Y)")
|
||||||
|
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
build:
|
||||||
|
name: Builder for ${{ matrix.package_type }} podkop and luci-app-podkop
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: preparation
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- { package_type: ipk }
|
||||||
|
- { package_type: apk }
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v5.0.0
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Extract version
|
- name: Build ${{ matrix.package_type }}
|
||||||
id: version
|
uses: docker/build-push-action@v6.18.0
|
||||||
run: |
|
|
||||||
VERSION=$(git describe --tags --exact-match 2>/dev/null || echo "dev_$(date +%d%m%Y)")
|
|
||||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Build and push
|
|
||||||
uses: docker/build-push-action@v6.9.0
|
|
||||||
with:
|
with:
|
||||||
|
file: ./Dockerfile-${{ matrix.package_type }}
|
||||||
context: .
|
context: .
|
||||||
tags: podkop:ci
|
tags: podkop:ci-${{ matrix.package_type }}
|
||||||
build-args: |
|
build-args: |
|
||||||
PKG_VERSION=${{ steps.version.outputs.version }}
|
PKG_VERSION=${{ needs.preparation.outputs.version }}
|
||||||
|
|
||||||
- name: Create Docker container
|
- name: Create ${{ matrix.package_type }} Docker container
|
||||||
run: docker create --name podkop podkop:ci
|
run: docker create --name ${{ matrix.package_type }} podkop:ci-${{ matrix.package_type }}
|
||||||
|
|
||||||
- name: Copy file from Docker container
|
- name: Copy files from ${{ matrix.package_type }} Docker container
|
||||||
run: |
|
run: |
|
||||||
docker cp podkop:/builder/bin/packages/x86_64/utilites/. ./bin/
|
mkdir -p ./bin/${{ matrix.package_type }}
|
||||||
docker cp podkop:/builder/bin/packages/x86_64/luci/. ./bin/
|
rm -f ./bin/${{ matrix.package_type }}/*.${{ matrix.package_type }} || true
|
||||||
|
docker cp ${{ matrix.package_type }}:/builder/bin/packages/x86_64/utilites/. ./bin/${{ matrix.package_type }}/
|
||||||
|
docker cp ${{ matrix.package_type }}:/builder/bin/packages/x86_64/luci/. ./bin/${{ matrix.package_type }}/
|
||||||
|
|
||||||
- name: Filter IPK files
|
# Проблема в том, что sdk которая генерирует apk файлы не использует `_` символ --> только `-` в именах итоговых файлов
|
||||||
|
- name: Fix naming difference between build for packages (replace _ with -)
|
||||||
|
if: matrix.package_type == 'ipk'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
for f in ./bin/${{ matrix.package_type }}/*.${{ matrix.package_type }}; do
|
||||||
|
[ -e "$f" ] || continue
|
||||||
|
base=$(basename "$f")
|
||||||
|
newname=$(echo "$base" | sed 's/_/-/g')
|
||||||
|
mv "$f" "./bin/${{ matrix.package_type }}/$newname"
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: Filter files
|
||||||
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
# Извлекаем версию из тега, убирая префикс 'v'
|
# Извлекаем версию из тега, убирая префикс 'v'
|
||||||
VERSION=${GITHUB_REF#refs/tags/v}
|
VERSION=${GITHUB_REF#refs/tags/v}
|
||||||
|
|
||||||
mkdir -p ./filtered-bin
|
mkdir -p ./filtered-bin/${{ matrix.package_type }}
|
||||||
cp ./bin/luci-i18n-podkop-ru_*.ipk "./filtered-bin/luci-i18n-podkop-ru_${VERSION}.ipk"
|
cp ./bin/${{ matrix.package_type }}/luci-i18n-podkop-ru-*.${{ matrix.package_type }} "./filtered-bin/luci-i18n-podkop-ru-${VERSION}.${{ matrix.package_type }}"
|
||||||
cp ./bin/podkop_*.ipk ./filtered-bin/
|
cp ./bin/${{ matrix.package_type }}/podkop-*.${{ matrix.package_type }} ./filtered-bin/
|
||||||
cp ./bin/luci-app-podkop_*.ipk ./filtered-bin/
|
cp ./bin/${{ matrix.package_type }}/luci-app-podkop-*.${{ matrix.package_type }} ./filtered-bin/
|
||||||
|
|
||||||
- name: Remove Docker container
|
- name: Remove Docker container
|
||||||
run: docker rm podkop
|
run: docker rm ${{ matrix.package_type }}
|
||||||
|
|
||||||
|
- name: Upload build artifacts
|
||||||
|
uses: actions/upload-artifact@v4.6.2
|
||||||
|
with:
|
||||||
|
name: release-files-${{ github.ref_name }}-${{ matrix.package_type }}
|
||||||
|
path: ./filtered-bin/${{ matrix.package_type }}/*.${{ matrix.package_type }}
|
||||||
|
retention-days: 1
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
release:
|
||||||
|
name: Create Release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: build
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v5.0.0
|
||||||
|
- name: Create release dir
|
||||||
|
run: mkdir -p ./filtered-bin/release
|
||||||
|
|
||||||
|
- name: Download ipk artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: release-files-${{ github.ref_name }}-ipk
|
||||||
|
path: ./filtered-bin/release
|
||||||
|
|
||||||
|
- name: Download apk artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: release-files-${{ github.ref_name }}-apk
|
||||||
|
path: ./filtered-bin/release
|
||||||
|
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@v2.0.8
|
uses: softprops/action-gh-release@v2.4.0
|
||||||
with:
|
with:
|
||||||
files: ./filtered-bin/*.ipk
|
files: ./filtered-bin/release/*.*
|
||||||
|
draft: false
|
||||||
|
prerelease: false
|
||||||
|
name: ${{ github.ref_name }}
|
||||||
|
tag_name: ${{ github.ref_name }}
|
||||||
Reference in New Issue
Block a user