-
-
Notifications
You must be signed in to change notification settings - Fork 7
86 lines (77 loc) · 2.96 KB
/
autobuild.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# for each folder in ultramarine/
# generate a new workflow for each folder in ultramarine/
name: Automatically build packages
on:
push:
paths:
- ultramarine/**
branches:
- main
- um39
workflow_dispatch:
workflow_call:
jobs:
manifest:
runs-on: ubuntu-latest
outputs:
build_matrix: ${{ steps.generate_build_matrix.outputs.build_matrix }}
is_empty: ${{ steps.generate_build_matrix.outputs.is_empty }}
# check out the repo
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 2
- run: git fetch
#- run: git checkout HEAD^
- name: Generate Build matrix
id: generate_build_matrix
# generate build matrix by checking out changes in ultramarine/
run: |
# get the list of changed folders in the current commit
changed_folders=$(git diff --name-only HEAD^ | grep -oP 'ultramarine\/(.+)\/' | sort -u )
echo "Changed folders: $changed_folders"
# if changed_folders is empty then set is empty to true
if [ -z "$changed_folders" ]; then
echo "::set-output name=is_empty::true"
else
echo "::set-output name=is_empty::false"
fi
# turn it into a json array
build_matrix=$(echo "$changed_folders" | jq -R . | jq -s . | jq -c .)
echo "::set-output name=build_matrix::$build_matrix"
#echo "::set-output name=build_matrix::$build_matrix"
build:
needs: manifest
strategy:
matrix:
pkg: ${{ fromJson(needs.manifest.outputs.build_matrix) }}
version: ["39"]
arch: ["x86_64", "aarch64"]
fail-fast: false
#if: ${{ matrix.changed_folders != '' }}
runs-on: ${{ matrix.arch == 'aarch64' && 'ARM64' || 'ubuntu-latest' }}
container:
image: registry.fedoraproject.org/fedora:${{ matrix.version }}
options: --cap-add=SYS_ADMIN --privileged
steps:
- name: Install repositories
run: |
sudo dnf install -y dnf-plugins-core
sudo dnf config-manager --add-repo https://github.com/andaman-common-pkgs/subatomic-repos/raw/main/um.repo
sudo dnf install -y ultramarine-mock-configs subatomic-cli anda mock rpm-build
- uses: andaman-common-pkgs/anda-build@main
if: ${{ !fromJson(needs.manifest.outputs.is_empty) }}
with:
name: "${{ matrix.pkg }}pkg"
mockConfig: ultramarine-${{ matrix.version }}-${{ matrix.arch }}
andaRepo: https://github.com/andaman-common-pkgs/subatomic-repos/raw/main/terra.repo
- name: Install Subatomic client
run: sudo dnf install -y subatomic-cli
- name: Upload packages to subatomic
if: ${{ !fromJson(needs.manifest.outputs.is_empty) }}
run: |
subatomic-cli upload --prune \
--server https://subatomic.fyralabs.com \
--token ${{ secrets.SUBATOMIC_TOKEN }} \
um${{ matrix.version }} anda-build/rpm/rpms/*