Adapt workflows for Gitea Actions
Some checks failed
Frontend CI / Frontend Quality Checks (push) Has been cancelled
Differential ShellCheck / Differential ShellCheck (push) Has been cancelled

This commit is contained in:
Денисов Александр Андреевич
2026-05-14 13:33:09 +03:00
parent b73012687e
commit 477aa8c65a
4 changed files with 138 additions and 142 deletions

124
.gitea/workflows/build.yml Normal file
View File

@@ -0,0 +1,124 @@
name: Build packages
on:
push:
tags:
- '*'
permissions:
contents: read
releases: write
jobs:
build-release:
name: Build packages and create Gitea release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5.0.0
with:
fetch-depth: 0
- name: Setup build version
id: version
run: |
VERSION=$(git describe --tags --exact-match 2>/dev/null || echo "0.$(date +%d%m%Y)")
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Build packages
shell: bash
run: |
set -euo pipefail
VERSION="${{ steps.version.outputs.version }}"
mkdir -p ./filtered-bin/release
for package_type in ipk apk; do
docker build \
-f "./Dockerfile-${package_type}" \
--build-arg "PODKOP_VERSION=${VERSION}" \
-t "podkop:ci-${package_type}" \
.
container="podkop-${package_type}"
docker create --name "$container" "podkop:ci-${package_type}"
mkdir -p "./bin/${package_type}"
docker cp "$container:/builder/bin/packages/x86_64/utilities/." "./bin/${package_type}/"
docker cp "$container:/builder/bin/packages/x86_64/luci/." "./bin/${package_type}/"
docker rm "$container"
if [ "$package_type" = "ipk" ]; then
for file in "./bin/${package_type}"/*.ipk; do
[ -e "$file" ] || continue
base=$(basename "$file")
newname=$(echo "$base" | sed 's/_/-/g')
mv "$file" "./bin/${package_type}/${newname}"
done
fi
mkdir -p "./filtered-bin/${package_type}"
cp "./bin/${package_type}"/luci-i18n-podkop-ru-*."${package_type}" \
"./filtered-bin/${package_type}/luci-i18n-podkop-ru-${VERSION}.${package_type}"
cp "./bin/${package_type}"/podkop-*."${package_type}" "./filtered-bin/${package_type}/"
cp "./bin/${package_type}"/luci-app-podkop-*."${package_type}" "./filtered-bin/${package_type}/"
cp "./filtered-bin/${package_type}"/*."${package_type}" ./filtered-bin/release/
done
- name: Create release and upload assets
shell: bash
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG_NAME: ${{ github.ref_name }}
REPOSITORY: ${{ github.repository }}
SERVER_URL: ${{ github.server_url }}
run: |
set -euo pipefail
TOKEN="${GITEA_TOKEN:-${GITHUB_TOKEN:-}}"
if [ -z "$TOKEN" ]; then
echo "GITEA_TOKEN or GITHUB_TOKEN secret is required to create a release" >&2
exit 1
fi
API_URL="${SERVER_URL%/}/api/v1"
http_code="$(curl -sS \
-H "Authorization: token $TOKEN" \
-o /tmp/release.json \
-w "%{http_code}" \
"$API_URL/repos/$REPOSITORY/releases/tags/$TAG_NAME")"
if [ "$http_code" = "200" ]; then
release_id="$(jq -r '.id' /tmp/release.json)"
else
release_json="$(jq -cn \
--arg tag "$TAG_NAME" \
--arg name "$TAG_NAME" \
'{tag_name: $tag, name: $name, draft: false, prerelease: false}')"
curl -sSf \
-H "Authorization: token $TOKEN" \
-H "Content-Type: application/json" \
-d "$release_json" \
"$API_URL/repos/$REPOSITORY/releases" \
> /tmp/release.json
release_id="$(jq -r '.id' /tmp/release.json)"
fi
if [ -z "$release_id" ] || [ "$release_id" = "null" ]; then
echo "Failed to read Gitea release id" >&2
cat /tmp/release.json >&2
exit 1
fi
for file in ./filtered-bin/release/*.*; do
[ -f "$file" ] || continue
curl -sSf \
-H "Authorization: token $TOKEN" \
-F "attachment=@${file}" \
"$API_URL/repos/$REPOSITORY/releases/$release_id/assets?name=$(basename "$file")" \
> /dev/null
done

View File

@@ -1,10 +1,16 @@
name: Frontend CI
on:
push:
branches:
- main
paths:
- 'fe-app-podkop/**'
- '.gitea/workflows/frontend-ci.yml'
pull_request:
paths:
- 'fe-app-podkop/**'
- '.github/workflows/frontend-ci.yml'
- '.gitea/workflows/frontend-ci.yml'
jobs:
frontend-checks:
@@ -44,12 +50,7 @@ jobs:
- name: Check formatting
id: format
run: |
yarn format
if ! git diff --exit-code; then
echo "::error::Code is not formatted. Run 'yarn format' locally."
exit 1
fi
run: yarn prettier --check src
- name: Run linter
run: yarn lint --max-warnings=0
@@ -71,8 +72,6 @@ jobs:
run: |
echo "## Frontend CI Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "- Format check: ${{ steps.format.outcome }}" >> $GITHUB_STEP_SUMMARY
echo "- Lint check: ${{ job.status }}" >> $GITHUB_STEP_SUMMARY
echo "- ✅ Tests: ${{ job.status }}" >> $GITHUB_STEP_SUMMARY
echo "- ✅ Build: ${{ steps.build.outcome }}" >> $GITHUB_STEP_SUMMARY
echo "![Success](https://cdn2.combot.org/boratbrat/webp/6xf09f988f.webp)" >> $GITHUB_STEP_SUMMARY
echo "- Format check: ${{ steps.format.outcome }}" >> $GITHUB_STEP_SUMMARY
echo "- Lint/tests status: ${{ job.status }}" >> $GITHUB_STEP_SUMMARY
echo "- Build: ${{ steps.build.outcome }}" >> $GITHUB_STEP_SUMMARY

View File

@@ -9,7 +9,7 @@ on:
- 'install.sh'
- 'podkop/files/usr/bin/**'
- 'podkop/files/usr/lib/**'
- '.github/workflows/shellcheck.yml'
- '.gitea/workflows/shellcheck.yml'
pull_request:
branches:
- main
@@ -18,20 +18,13 @@ on:
- 'install.sh'
- 'podkop/files/usr/bin/**'
- 'podkop/files/usr/lib/**'
- '.github/workflows/shellcheck.yml'
permissions:
contents: read
- '.gitea/workflows/shellcheck.yml'
jobs:
shellcheck:
name: Differential ShellCheck
runs-on: ubuntu-24.04
permissions:
contents: read
security-events: write
steps:
- name: Checkout code
uses: actions/checkout@v5.0.0
@@ -46,4 +39,3 @@ jobs:
podkop/files/usr/bin/podkop
podkop/files/usr/lib/**.sh
install.sh
token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -1,119 +0,0 @@
name: Build packages
on:
push:
tags:
- '*'
permissions:
contents: write
jobs:
preparation:
name: Setup build version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v5.0.0
with:
fetch-depth: 0
- id: version
run: |
VERSION=$(git describe --tags --exact-match 2>/dev/null || echo "0.$(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:
fetch-depth: 0
- name: Build ${{ matrix.package_type }}
uses: docker/build-push-action@v6.18.0
with:
file: ./Dockerfile-${{ matrix.package_type }}
context: .
tags: podkop:ci-${{ matrix.package_type }}
build-args: |
PODKOP_VERSION=${{ needs.preparation.outputs.version }}
- name: Create ${{ matrix.package_type }} Docker container
run: docker create --name ${{ matrix.package_type }} podkop:ci-${{ matrix.package_type }}
- name: Copy files from ${{ matrix.package_type }} Docker container
run: |
mkdir -p ./bin/${{ matrix.package_type }}
docker cp ${{ matrix.package_type }}:/builder/bin/packages/x86_64/utilities/. ./bin/${{ matrix.package_type }}/
docker cp ${{ matrix.package_type }}:/builder/bin/packages/x86_64/luci/. ./bin/${{ matrix.package_type }}/
# IPK uses underscore `_` in filenames, while APK uses only dash `-`
- 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: |
# Use version from preparation job (already without 'v' prefix)
VERSION="${{ needs.preparation.outputs.version }}"
mkdir -p ./filtered-bin/${{ matrix.package_type }}
cp ./bin/${{ matrix.package_type }}/luci-i18n-podkop-ru-*.${{ matrix.package_type }} "./filtered-bin/${{ matrix.package_type }}/luci-i18n-podkop-ru-${VERSION}.${{ matrix.package_type }}"
cp ./bin/${{ matrix.package_type }}/podkop-*.${{ matrix.package_type }} ./filtered-bin/${{ matrix.package_type }}/
cp ./bin/${{ matrix.package_type }}/luci-app-podkop-*.${{ matrix.package_type }} ./filtered-bin/${{ matrix.package_type }}/
- name: Remove Docker container
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
uses: softprops/action-gh-release@v2.4.0
with:
files: ./filtered-bin/release/*.*
draft: false
prerelease: false
name: ${{ github.ref_name }}
tag_name: ${{ github.ref_name }}