Fix Gitea Actions workflow compatibility and correct directory paths
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 5s
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 5s
This commit is contained in:
@@ -31,15 +31,18 @@ jobs:
|
|||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITEA_TOKEN }}
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Check for new Zabbix version
|
- name: Check for new Zabbix version
|
||||||
id: version-check
|
id: version-check
|
||||||
run: |
|
run: |
|
||||||
# Get current version from APKBUILD
|
# Install jq for JSON parsing
|
||||||
CURRENT_VERSION=$(grep '^pkgver=' APKBUILD | cut -d'=' -f2)
|
sudo apt-get update && sudo apt-get install -y jq
|
||||||
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
|
|
||||||
|
# Get current version from APKBUILD (correct path)
|
||||||
|
CURRENT_VERSION=$(grep '^pkgver=' zabbix-apk-builder/APKBUILD | cut -d'=' -f2)
|
||||||
|
echo "current_version=$CURRENT_VERSION" >> $GITEA_OUTPUT
|
||||||
echo "Current version: $CURRENT_VERSION"
|
echo "Current version: $CURRENT_VERSION"
|
||||||
|
|
||||||
# Get latest version from Zabbix Bitbucket API (stable releases only)
|
# Get latest version from Zabbix Bitbucket API (stable releases only)
|
||||||
@@ -50,15 +53,15 @@ jobs:
|
|||||||
sort -V | \
|
sort -V | \
|
||||||
tail -1)
|
tail -1)
|
||||||
|
|
||||||
echo "latest_version=$LATEST_VERSION" >> $GITHUB_OUTPUT
|
echo "latest_version=$LATEST_VERSION" >> $GITEA_OUTPUT
|
||||||
echo "Latest version: $LATEST_VERSION"
|
echo "Latest version: $LATEST_VERSION"
|
||||||
|
|
||||||
# Determine if we should build
|
# Determine if we should build
|
||||||
if [ "$CURRENT_VERSION" != "$LATEST_VERSION" ] || [ "${{ inputs.force_build }}" = "true" ]; then
|
if [ "$CURRENT_VERSION" != "$LATEST_VERSION" ] || [ "${{ inputs.force_build }}" = "true" ]; then
|
||||||
echo "should_build=true" >> $GITHUB_OUTPUT
|
echo "should_build=true" >> $GITEA_OUTPUT
|
||||||
echo "Build required: Version changed or force build requested"
|
echo "Build required: Version changed or force build requested"
|
||||||
else
|
else
|
||||||
echo "should_build=false" >> $GITHUB_OUTPUT
|
echo "should_build=false" >> $GITEA_OUTPUT
|
||||||
echo "No build required: Version unchanged"
|
echo "No build required: Version unchanged"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -71,7 +74,7 @@ jobs:
|
|||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITEA_TOKEN }}
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Update APKBUILD version
|
- name: Update APKBUILD version
|
||||||
@@ -82,19 +85,19 @@ jobs:
|
|||||||
if [ "$CURRENT_VERSION" != "$LATEST_VERSION" ]; then
|
if [ "$CURRENT_VERSION" != "$LATEST_VERSION" ]; then
|
||||||
echo "Updating APKBUILD from $CURRENT_VERSION to $LATEST_VERSION"
|
echo "Updating APKBUILD from $CURRENT_VERSION to $LATEST_VERSION"
|
||||||
|
|
||||||
# Update pkgver
|
# Update pkgver (correct path)
|
||||||
sed -i "s/^pkgver=.*/pkgver=$LATEST_VERSION/" APKBUILD
|
sed -i "s/^pkgver=.*/pkgver=$LATEST_VERSION/" zabbix-apk-builder/APKBUILD
|
||||||
|
|
||||||
# Reset pkgrel to 0 for new version
|
# Reset pkgrel to 0 for new version
|
||||||
sed -i "s/^pkgrel=.*/pkgrel=0/" APKBUILD
|
sed -i "s/^pkgrel=.*/pkgrel=0/" zabbix-apk-builder/APKBUILD
|
||||||
|
|
||||||
# Clear checksums (will be regenerated during build)
|
# Clear checksums (will be regenerated during build)
|
||||||
sed -i '/^sha512sums="/,/^"$/c\sha512sums="\nSKIP\nSKIP\nSKIP\nSKIP\nSKIP\n"' APKBUILD
|
sed -i 's/^sha512sums=.*/sha512sums="SKIP"/' zabbix-apk-builder/APKBUILD
|
||||||
|
|
||||||
# Commit changes
|
# Commit changes
|
||||||
git config --local user.email "action@github.com"
|
git config --local user.email "action@gitea.com"
|
||||||
git config --local user.name "GitHub Action"
|
git config --local user.name "Gitea Action"
|
||||||
git add APKBUILD
|
git add zabbix-apk-builder/APKBUILD
|
||||||
git commit -m "Update Zabbix to version $LATEST_VERSION" || exit 0
|
git commit -m "Update Zabbix to version $LATEST_VERSION" || exit 0
|
||||||
git push
|
git push
|
||||||
fi
|
fi
|
||||||
@@ -108,7 +111,7 @@ jobs:
|
|||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: ${{ github.ref }}
|
ref: ${{ gitea.ref }}
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
@@ -116,22 +119,23 @@ jobs:
|
|||||||
|
|
||||||
- name: Build Zabbix packages
|
- name: Build Zabbix packages
|
||||||
run: |
|
run: |
|
||||||
|
cd zabbix-apk-builder
|
||||||
chmod +x build.sh
|
chmod +x build.sh
|
||||||
./build.sh
|
./build.sh
|
||||||
|
|
||||||
- name: List built packages
|
- name: List built packages
|
||||||
run: |
|
run: |
|
||||||
echo "Built packages:"
|
echo "Built packages:"
|
||||||
ls -la packages/
|
ls -la zabbix-apk-builder/packages/
|
||||||
|
|
||||||
echo "Package sizes:"
|
echo "Package sizes:"
|
||||||
du -h packages/*.apk
|
du -h zabbix-apk-builder/packages/*.apk
|
||||||
|
|
||||||
- name: Upload packages as artifacts
|
- name: Upload packages as artifacts
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: zabbix-apk-packages
|
name: zabbix-apk-packages
|
||||||
path: packages/*.apk
|
path: zabbix-apk-builder/packages/*.apk
|
||||||
retention-days: 30
|
retention-days: 30
|
||||||
|
|
||||||
|
|
||||||
@@ -175,15 +179,15 @@ jobs:
|
|||||||
ls *.apk > PACKAGES.txt
|
ls *.apk > PACKAGES.txt
|
||||||
|
|
||||||
# Commit and push
|
# Commit and push
|
||||||
git config --local user.email "action@github.com"
|
git config --local user.email "action@gitea.com"
|
||||||
git config --local user.name "GitHub Action"
|
git config --local user.name "Gitea Action"
|
||||||
git add .
|
git add .
|
||||||
git commit -m "Add Zabbix ${{ needs.check-version.outputs.latest_version }} packages" || exit 0
|
git commit -m "Add Zabbix ${{ needs.check-version.outputs.latest_version }} packages" || exit 0
|
||||||
git push
|
git push
|
||||||
|
|
||||||
deploy-test:
|
deploy-test:
|
||||||
needs: [check-version, build-packages]
|
needs: [check-version, build-packages]
|
||||||
if: needs.check-version.outputs.should_build == 'true' && github.ref == 'refs/heads/test'
|
if: needs.check-version.outputs.should_build == 'true' && gitea.ref == 'refs/heads/test'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
Reference in New Issue
Block a user