Fix template to support new function return #10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "cloudmin.dev: virtualmin/cloudmin-stack-meta" | |
| on: | |
| push: | |
| branches: | |
| - main | |
| release: | |
| types: | |
| - published | |
| env: | |
| IS_RELEASE: ${{ github.event_name == 'release' }} | |
| BUILD_DEPS: "tar curl gzip dpkg-dev fakeroot build-essential coreutils" | |
| BUILD_BOOTSTRAP: "https://raw.githubusercontent.com/webmin/webmin-ci-cd/main/build/bootstrap.bash" | |
| jobs: | |
| build-amd64: | |
| runs-on: ubuntu-latest | |
| if: ${{ !contains(github.event.head_commit.message, '[no-build]') }} | |
| env: | |
| TZ: Europe/Nicosia | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: awalsh128/cache-apt-pkgs-action@latest | |
| with: | |
| packages: ${{ env.BUILD_DEPS }} | |
| version: 1.0 | |
| - name: Fetch dependencies | |
| run: curl -O ${{ env.BUILD_BOOTSTRAP }} | |
| - name: Set timezone | |
| run: sudo timedatectl set-timezone ${{ env.TZ }} | |
| - name: Build packages | |
| env: | |
| CLOUD__GPG_PH: ${{ secrets.DEV_GPG_PH }} | |
| CLOUD__IP_ADDR: ${{ secrets.DEV_IP_ADDR }} | |
| CLOUD__IP_KNOWN_HOSTS: ${{ secrets.DEV_IP_KNOWN_HOSTS }} | |
| CLOUD__UPLOAD_SSH_USER: ${{ secrets.DEV_UPLOAD_SSH_USER }} | |
| CLOUD__UPLOAD_SSH_DIR: ${{ env.IS_RELEASE == 'true' && secrets.PRERELEASE_UPLOAD_SSH_DIR || secrets.DEV_UPLOAD_SSH_DIR }} | |
| CLOUD__SSH_PRV_KEY: ${{ secrets.DEV_SSH_PRV_KEY }} | |
| CLOUD__SIGN_BUILD_REPOS_CMD: ${{ secrets.DEV_SIGN_BUILD_REPOS_CMD }} | |
| run: |- | |
| set -euo pipefail | |
| # Check testing flag | |
| testing=$([[ "${{ env.IS_RELEASE }}" == "false" ]] && echo "--testing" || echo "") | |
| # Bootstrap build | |
| source bootstrap.bash "$testing" | |
| # Parse debian control and build packages | |
| while IFS= read -r line; do | |
| case $line in | |
| PACKAGE_START) | |
| unset pkg_name pkg_version pkg_release pkg_depends pkg_recommends \ | |
| pkg_suggests pkg_replaces pkg_homepage pkg_summary \ | |
| pkg_description | |
| ;; | |
| PACKAGE_END) | |
| [[ $pkg_name && $pkg_version ]] || continue | |
| decoded_description= | |
| [[ ${pkg_description:-} ]] && \ | |
| decoded_description=$(echo "$pkg_description" | base64 --decode) | |
| build_native_package \ | |
| --architectures "noarch" \ | |
| --target-dir "$ROOT_REPOS" \ | |
| --base-name "$pkg_name" \ | |
| --version "$pkg_version" \ | |
| --release "${pkg_release:-1}" \ | |
| --depends "${pkg_depends:-}" \ | |
| --recommends "${pkg_recommends:-}" \ | |
| --suggests "${pkg_suggests:-}" \ | |
| --replaces "${pkg_replaces:-}" \ | |
| --skip rpm \ | |
| --description "${decoded_description:-}" \ | |
| --homepage "${pkg_homepage:-}" | |
| ;; | |
| *=*) | |
| # split the key-value safely | |
| key=${line%%=*} | |
| val=${line#*=} | |
| case $key in | |
| name) pkg_name=$val ;; | |
| version) pkg_version=$val ;; | |
| release) pkg_release=$val ;; | |
| depends) pkg_depends=$val ;; | |
| recommends) pkg_recommends=$val ;; | |
| suggests) pkg_suggests=$val ;; | |
| replaces) pkg_replaces=$val ;; | |
| homepage) pkg_homepage=$val ;; | |
| summary) pkg_summary=$val ;; | |
| description) pkg_description=$val ;; | |
| esac | |
| ;; | |
| esac | |
| done < <(parse_debian_control "." "$testing") | |
| # Upload and sign | |
| upload_list=("$ROOT_REPOS/"*) | |
| cloud_upload upload_list | |
| cloud_sign_and_build_repos cloudmin.dev |