name: JSON Build permissions: contents: read on: workflow_call: inputs: packages: description: "Packages to Build" required: true type: string publish: description: "Whether the package should be published" required: false type: boolean default: true custom_builder: description: "Custom Builder" required: false type: string default: "" workflow_dispatch: inputs: packages: description: "Packages to Build" required: true type: string publish: description: "Whether the package should be published" required: false type: boolean default: true jobs: build: strategy: matrix: pkg: ${{ fromJson(inputs.packages) }} version: ["10"] fail-fast: false runs-on: ${{ inputs.custom_builder && inputs.custom_builder || (matrix.pkg.arch == 'aarch64' && matrix.pkg.labels['large']) && 'arm64-lg' || matrix.pkg.arch == 'aarch64' && 'ubuntu-22.04-arm' || matrix.pkg.labels['large'] && format('cirun-x86-64-lg--{0}', github.run_id) || 'ubuntu-22.04' }} container: image: ghcr.io/terrapkg/builder:el${{ matrix.version }} options: --cap-add=SYS_ADMIN --privileged steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up git repository run: git config --global --add safe.directory "$GITHUB_WORKSPACE" - name: CI Setup Script if: ${{ !contains(matrix.pkg.labels, 'mock') }} run: | dir=$(dirname ${{ matrix.pkg.pkg }}) if [ -f $dir/ci_setup.rhai ]; then anda run $dir/ci_setup.rhai --labels script_path=$dir/ci_setup.rhai fi - name: Install Build Dependencies if: ${{ matrix.pkg.labels.mock != '1' }} run: | dir=$(dirname ${{ matrix.pkg.pkg }}) dnf builddep -y ${dir}/*.spec - name: Build with Andaman run: anda build -D "vendor Terra" ${{ matrix.pkg.pkg }} -c terra-el${{ matrix.version }}-${{ matrix.pkg.arch }} ${{ !matrix.pkg.labels.mock == '1' && '-rrpmbuild' || '' }} - name: Generating artifact name id: art run: | NAME=${{ matrix.pkg.pkg }}-${{ matrix.pkg.arch }}-${{ matrix.version }} x=${NAME//\//@} echo "name=$x" >> $GITHUB_OUTPUT - uses: actions/upload-artifact@v4 with: name: ${{ steps.art.outputs.name }} compression-level: 0 # The RPMs are already compressed :p path: | anda-build/rpm/rpms/* anda-build/rpm/srpm/* - name: Upload packages to subatomic if: inputs.publish run: | subatomic-cli upload --prune \ --server https://subatomic.fyralabs.com \ --token ${{ secrets.SUBATOMIC_TOKEN }} \ terrael${{ matrix.version }} anda-build/rpm/rpms/* - name: Upload source packages to subatomic if: inputs.publish && matrix.pkg.labels['no_upload_srpms'] != '1' run: | subatomic-cli upload --prune \ --server https://subatomic.fyralabs.com \ --token ${{ secrets.SUBATOMIC_TOKEN }} \ terrael${{ matrix.version }}-source anda-build/rpm/srpm/* - name: Notify Madoguchi (Success) if: success() run: ./.github/workflows/mg.sh true ${{matrix.pkg.pkg}} el${{matrix.version}} ${{matrix.pkg.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}} $GITHUB_SHA - name: Notify Madoguchi (Failure) if: inputs.publish && (cancelled() || failure()) run: ./.github/workflows/mg.sh false ${{matrix.pkg.pkg}} el${{matrix.version}} ${{matrix.pkg.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}} $GITHUB_SHA