Build Tools Bundle #13
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: Build Tools Bundle | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 0 1 * *' # Monthly on the 1st | |
| env: | |
| FREEBSD_RELEASE: "15.1" | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Build bundle in FreeBSD VM | |
| uses: vmactions/freebsd-vm@v1.4.7 | |
| with: | |
| release: ${{ env.FREEBSD_RELEASE }} | |
| usesh: true | |
| copyback: true | |
| run: | | |
| set -e | |
| mkdir -p /tmp/packages | |
| # Use latest repo for fetching | |
| mkdir -p /etc/pkg | |
| echo 'FreeBSD: { url: "http://pkg.FreeBSD.org/${ABI}/latest" }' > /etc/pkg/FreeBSD.conf | |
| pkg update -f | |
| # Fetch all packages with full dependency tree | |
| pkg fetch --dependencies --yes --output /tmp/packages \ | |
| podman \ | |
| sysutils/podman-compose \ | |
| jq \ | |
| skopeo \ | |
| buildah \ | |
| trivy \ | |
| python3 \ | |
| devel/py-pyyaml \ | |
| appjail \ | |
| ocijail | |
| # Create dated bundle in repo working dir (copyback picks it up) | |
| BUNDLE="freebsd-${{ env.FREEBSD_RELEASE }}-$(date +%Y%m%d).tar.gz" | |
| tar czf "$BUNDLE" -C /tmp/packages . | |
| echo "Created $BUNDLE ($(du -sh $BUNDLE | cut -f1))" | |
| # aarch64 bundle: cross-fetch with an isolated pkg db; ABI + OSVERSION | |
| # derived from the host so nothing is version-pinned. | |
| AARCH64_ABI=$(pkg config ABI | sed 's/:[^:]*$/:aarch64/') | |
| mkdir -p /tmp/aarch64-repo /tmp/aarch64-db /tmp/aarch64-cache /tmp/packages-aarch64 | |
| printf 'FreeBSD: { url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest", mirror_type: srv, signature_type: fingerprints, fingerprints: /usr/share/keys/pkg, enabled: yes }\n' > /tmp/aarch64-repo/FreeBSD.conf | |
| XFETCH="-o ABI=$AARCH64_ABI -o OSVERSION=$(uname -K) -o REPOS_DIR=/tmp/aarch64-repo -o PKG_DBDIR=/tmp/aarch64-db -o PKG_CACHEDIR=/tmp/aarch64-cache -o ASSUME_ALWAYS_YES=yes" | |
| pkg $XFETCH update -f | |
| pkg $XFETCH fetch --dependencies --yes --output /tmp/packages-aarch64 \ | |
| podman \ | |
| sysutils/podman-compose \ | |
| jq \ | |
| skopeo \ | |
| buildah \ | |
| trivy \ | |
| python3 \ | |
| devel/py-pyyaml \ | |
| appjail \ | |
| ocijail | |
| ARM_BUNDLE="freebsd-${{ env.FREEBSD_RELEASE }}-$(date +%Y%m%d)-aarch64.tar.gz" | |
| tar czf "$ARM_BUNDLE" -C /tmp/packages-aarch64 . | |
| echo "Created $ARM_BUNDLE ($(du -sh $ARM_BUNDLE | cut -f1))" | |
| # No aarch64 screenshot bundle: chromium isn't built for aarch64. | |
| # Screenshot bundle (chromium + selenium + scikit-image for CIT screenshot mode) | |
| # Fetch with full dep tree, then strip packages already in the main bundle | |
| mkdir -p /tmp/packages-screenshot-raw /tmp/packages-screenshot/All/Hashed | |
| pkg fetch --dependencies --yes --output /tmp/packages-screenshot-raw \ | |
| chromium \ | |
| www/py-selenium \ | |
| graphics/py-scikit-image | |
| for f in /tmp/packages-screenshot-raw/All/Hashed/*.pkg; do | |
| [ -f "/tmp/packages/All/Hashed/$(basename $f)" ] || cp "$f" /tmp/packages-screenshot/All/Hashed/ | |
| done | |
| SS_BUNDLE="freebsd-${{ env.FREEBSD_RELEASE }}-screenshot-$(date +%Y%m%d).tar.gz" | |
| tar czf "$SS_BUNDLE" -C /tmp/packages-screenshot . | |
| echo "Created $SS_BUNDLE ($(du -sh $SS_BUNDLE | cut -f1))" | |
| # Render release notes here (pkg rquery only works inside the VM); | |
| # release-notes.txt is copied back for the host's publish step. | |
| get_ver() { V=$(pkg rquery '%v' "$1" 2>/dev/null); echo "${V:-?}"; } | |
| sed \ | |
| -e "s/{{ release }}/${{ env.FREEBSD_RELEASE }}/g" \ | |
| -e "s/{{ podman_version }}/$(get_ver podman)/g" \ | |
| -e "s/{{ buildah_version }}/$(get_ver buildah)/g" \ | |
| -e "s/{{ trivy_version }}/$(get_ver trivy)/g" \ | |
| -e "s/{{ chromium_version }}/$(get_ver chromium)/g" \ | |
| -e "s/{{ selenium_version }}/$(get_ver www/py-selenium)/g" \ | |
| -e "s/{{ scikit_version }}/$(get_ver graphics/py-scikit-image)/g" \ | |
| .github/release-notes.md.j2 > release-notes.txt | |
| - name: Publish release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| BUNDLE="freebsd-${{ env.FREEBSD_RELEASE }}-$(date +%Y%m%d).tar.gz" | |
| TAG="freebsd-${{ env.FREEBSD_RELEASE }}-$(date +%Y%m%d)" | |
| SS_BUNDLE="freebsd-${{ env.FREEBSD_RELEASE }}-screenshot-$(date +%Y%m%d).tar.gz" | |
| ARM_BUNDLE="freebsd-${{ env.FREEBSD_RELEASE }}-$(date +%Y%m%d)-aarch64.tar.gz" | |
| gh release create "$TAG" \ | |
| --title "FreeBSD ${{ env.FREEBSD_RELEASE }} build tools $(date +%Y%m%d)" \ | |
| --notes-file "${GITHUB_WORKSPACE}/release-notes.txt" \ | |
| "$BUNDLE" \ | |
| "$ARM_BUNDLE" \ | |
| "$SS_BUNDLE" | |
| # Keep only the 3 most recent releases, delete older ones | |
| gh release list --limit 100 --json tagName --jq '.[].tagName' \ | |
| | tail -n +4 \ | |
| | xargs -r -I{} gh release delete {} --yes --cleanup-tag |