fix(ci): rename config to yml for cit compatibility #6
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 FreeBSD Container | |
| on: | |
| push: | |
| branches: [main] | |
| paths-ignore: ['*.md', 'LICENSE', '.gitignore'] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| CIT_VERSION: "0.2.2" | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # Build with base:15 (latest packages) | |
| - base_version: "15" | |
| tags: "15,latest,pkg-latest" | |
| # Build with base:15-quarterly | |
| - base_version: "15-quarterly" | |
| tags: "15-quarterly,pkg" | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Build in FreeBSD VM (${{ matrix.base_version }}) | |
| uses: vmactions/freebsd-vm@v1.3.5 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GITHUB_ACTOR: ${{ github.actor }} | |
| with: | |
| release: "15.0" | |
| usesh: true | |
| copyback: false | |
| envs: "GITHUB_TOKEN GITHUB_ACTOR" | |
| prepare: | | |
| set -e | |
| mkdir -p /etc/pkg | |
| echo 'FreeBSD: { url: "http://pkg.FreeBSD.org/${ABI}/latest" }' > /etc/pkg/FreeBSD.conf | |
| pkg update -f | |
| pkg install -y podman | |
| rm -rf /var/db/containers /var/lib/containers 2>/dev/null || true | |
| kldload pf | |
| sysctl net.inet.ip.forwarding=1 | |
| run: | | |
| set -e | |
| # Download shared build script (pinned to version) | |
| mkdir -p scripts | |
| fetch -qo scripts/build-intermediate.sh \ | |
| "https://raw.githubusercontent.com/daemonless/daemonless/build-intermediate-v1.0.0/scripts/build-intermediate.sh" | |
| chmod +x scripts/build-intermediate.sh | |
| # Build (no push yet) | |
| ./scripts/build-intermediate.sh \ | |
| --registry ${{ env.REGISTRY }} \ | |
| --image ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} \ | |
| --base-version ${{ matrix.base_version }} \ | |
| --tags "${{ matrix.tags }}" | |
| # Test with cit (shell mode for base images) | |
| echo "=== Running cit tests ===" | |
| fetch -qo - https://github.com/daemonless/cit/releases/download/v${{ env.CIT_VERSION }}/cit-${{ env.CIT_VERSION }}.tar.gz | tar xz | |
| ./cit-${{ env.CIT_VERSION }}/cit --setup | |
| mkdir -p cit-results | |
| ./cit-${{ env.CIT_VERSION }}/cit ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:build \ | |
| --mode shell \ | |
| --json cit-results/arr-base-${{ matrix.base_version }}.json \ | |
| --verbose | |
| # Push only after cit passes (non-PR) | |
| if [ "${{ github.event_name }}" != "pull_request" ]; then | |
| echo "=== Pushing image ===" | |
| ./scripts/build-intermediate.sh \ | |
| --registry ${{ env.REGISTRY }} \ | |
| --image ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} \ | |
| --base-version ${{ matrix.base_version }} \ | |
| --tags "${{ matrix.tags }}" \ | |
| --login --push | |
| fi | |
| - name: Upload test artifacts | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: cit-results-${{ matrix.base_version }} | |
| path: cit-results/ | |
| retention-days: 30 | |
| - name: Discord notification | |
| if: always() && (matrix.base_version == '15' || job.status == 'failure') | |
| env: | |
| DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
| run: | | |
| if [ "${{ job.status }}" = "success" ]; then | |
| COLOR=3066993 | |
| STATUS="✅ Success" | |
| else | |
| COLOR=15158332 | |
| STATUS="❌ Failed" | |
| fi | |
| SHORT_SHA="${{ github.sha }}" | |
| SHORT_SHA="${SHORT_SHA:0:7}" | |
| curl -sS -H "Content-Type: application/json" \ | |
| -d "{\"embeds\":[{\"title\":\"arr-base:${{ matrix.base_version }} $STATUS\",\"url\":\"${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\",\"color\":$COLOR,\"fields\":[{\"name\":\"Commit\",\"value\":\"[$SHORT_SHA](${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }})\",\"inline\":true},{\"name\":\"Branch\",\"value\":\"${{ github.ref_name }}\",\"inline\":true},{\"name\":\"Registry\",\"value\":\"[ghcr.io](https://ghcr.io/${{ env.IMAGE_NAME }})\",\"inline\":true}]}]}" \ | |
| "$DISCORD_WEBHOOK" |