Manual Builds #388
This file contains 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: Manual Builds | |
on: | |
workflow_dispatch: | |
inputs: | |
packages: | |
description: "Packages to Build" | |
required: true | |
custom_builder: | |
description: "Custom Builder" | |
required: false | |
default: "" | |
architecture: | |
description: "Architecture" | |
required: false | |
default: all | |
type: string | |
jobs: | |
parse: | |
outputs: | |
pkgs: ${{ steps.parsing.outputs.pkgs }} | |
builder: ${{ inputs.custom_builder }} | |
arch: ${{ steps.parsing.outputs.arch }} | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Parse Input | |
id: parsing | |
run: | | |
echo "${{ inputs.packages }}" | sed 's/ /\n/g' | sed 's/$/\//g' | jq -R . | jq -s . | jq -c . | sed 's/^/pkgs=/' >> $GITHUB_OUTPUT | |
echo "builder=${{ inputs.custom_builder }}" >> $GITHUB_OUTPUT | |
arch="${{ inputs.architecture }}" | |
# Convert to json array using jq | |
# if arch is not all, convert to array | |
if [ "$arch" != "all" ]; then | |
# jq, array with single element as string | |
arch=$(echo $arch | sed 's/,/\n/g') | |
echo "arch=$(echo $arch | jq -Rs 'split("\n")' | jq 'map(select(length > 0))' | jq -c .)" >> $GITHUB_OUTPUT | |
else | |
echo "arch=$(echo '["aarch64", "x86_64"]' | jq -c .)" >> $GITHUB_OUTPUT | |
fi | |
build: | |
needs: parse | |
strategy: | |
matrix: | |
pkg: ${{ fromJson(needs.parse.outputs.pkgs) }} | |
version: ["rawhide"] | |
arch: ${{ fromJson(needs.parse.outputs.arch) }} | |
fail-fast: false | |
runs-on: ${{ matrix.arch == 'aarch64' && 'ARM64' || needs.parse.outputs.builder && needs.parse.outputs.builder || 'ubuntu-22.04' }} | |
container: | |
image: ghcr.io/terrapkg/builder:f${{ 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: Build with Andaman | |
run: anda build -c terra-${{ matrix.version }}-${{ matrix.arch }} anda/${{ matrix.pkg }}pkg | |
- name: Generating artifact name | |
id: art | |
run: | | |
NAME=${{ matrix.pkg }}-${{ matrix.arch }}-${{ matrix.version }} | |
x=${NAME//\//@} | |
echo "name=$x" >> $GITHUB_OUTPUT | |
echo "labels=$(anda run andax/get_proj_label.rhai -l project=anda/${{ matrix.pkg }}anda.hcl)" >> $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 | |
run: | | |
subatomic-cli upload --prune \ | |
--server https://subatomic.fyralabs.com \ | |
--token ${{ secrets.SUBATOMIC_TOKEN }} \ | |
terra${{ matrix.version }}${{ fromJson(steps.art.outputs.labels)['extra'] && '-extras' }} anda-build/rpm/rpms/* | |
- name: Upload source packages to subatomic | |
run: | | |
subatomic-cli upload --prune \ | |
--server https://subatomic.fyralabs.com \ | |
--token ${{ secrets.SUBATOMIC_TOKEN }} \ | |
terra${{ matrix.version }}${{ fromJson(steps.art.outputs.labels)['extra'] && '-extras' }}-source anda-build/rpm/srpm/* | |
- name: Notify Madoguchi (Success) | |
if: success() | |
run: ./.github/workflows/mg.sh true ${{matrix.pkg}} ${{matrix.version}} ${{matrix.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}} $GITHUB_SHA | |
- name: Notify Madoguchi (Failure) | |
if: cancelled() || failure() | |
run: ./.github/workflows/mg.sh false ${{matrix.pkg}} ${{matrix.version}} ${{matrix.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}} $GITHUB_SHA |