mirror of
https://github.com/terrapkg/packages.git
synced 2026-05-31 17:11:56 +00:00
e83a8d4cbf
* feat(ci): add no_upload_srpms label
This also fixes manual builds to support subrepos properly.
* to make sure it actually works
* manually set permissions
(cherry picked from commit bc5a6c144c)
Signed-off-by: GildedRoach <GildedRoach@users.noreply.github.com>
Co-authored-by: madomado <madonuko@outlook.com>
116 lines
4.3 KiB
YAML
116 lines
4.3 KiB
YAML
name: Manual Builds
|
|
permissions:
|
|
contents: read
|
|
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: ["41"]
|
|
arch: ${{ fromJson(needs.parse.outputs.arch) }}
|
|
fail-fast: false
|
|
runs-on: ${{ matrix.arch == 'aarch64' && 'ubuntu-22.04-arm' || 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: Checkout latest Mock configs
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: terrapkg/mock-configs
|
|
path: mock-configs
|
|
|
|
- name: Set up git repository
|
|
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
|
|
|
- name: Include custom build template instead of package default
|
|
run: |
|
|
cp -v mock-configs/terra.tpl /etc/mock/templates/terra.tpl
|
|
|
|
- name: Build with Andaman
|
|
run: anda build -D "vendor Terra" -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
|
|
|
|
- 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: |
|
|
subrepo="${{ fromJson(steps.art.outputs.labels).subrepo }}"
|
|
subatomic-cli upload --prune \
|
|
--server https://subatomic.fyralabs.com \
|
|
--token ${{ secrets.SUBATOMIC_TOKEN }} \
|
|
terra${{ matrix.version }}${{ fromJson(steps.art.outputs.labels)['subrepo'] && '-$subrepo' }} anda-build/rpm/rpms/*
|
|
|
|
- name: Upload source packages to subatomic
|
|
if: fromJson(steps.art.outputs.labels)['no_upload_srpms'] != '1'
|
|
run: |
|
|
subrepo="${{ fromJson(steps.art.outputs.labels).subrepo }}"
|
|
subatomic-cli upload --prune \
|
|
--server https://subatomic.fyralabs.com \
|
|
--token ${{ secrets.SUBATOMIC_TOKEN }} \
|
|
terra${{ matrix.version }}${{ fromJson(steps.art.outputs.labels)['subrepo'] && '-$subrepo' }}-source anda-build/rpm/srpm/*
|
|
|
|
- name: Notify Madoguchi (Success)
|
|
if: success()
|
|
run: ./.github/workflows/mg.sh true "anda/${{matrix.pkg}}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 "anda/${{matrix.pkg}}pkg" "${{matrix.version}}" "${{matrix.arch}}" "${{github.run_id}}" "${{secrets.MADOGUCHI_JWT}}" "$GITHUB_SHA"
|