-
-
Notifications
You must be signed in to change notification settings - Fork 27
92 lines (85 loc) · 3.21 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
87
88
89
90
91
92
# for each folder in anda/
# generate a new workflow for each folder in anda/
name: Automatically build packages
on:
push:
paths:
- anda/**
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
workflow_call:
jobs:
manifest:
runs-on: ubuntu-latest
outputs:
build_matrix: ${{ steps.generate_build_matrix.outputs.build_matrix }}
container:
image: ghcr.io/terrapkg/builder:main
options: --cap-add=SYS_ADMIN --privileged
steps:
- name: Set workspace as safe
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
#- run: git checkout HEAD^
# - name: Generate Build matrix
# id: generate_build_matrix
# # generate build matrix by checking out changes in anda/
# run: |
# # get the list of changed folders in the current commit, including subfolders
# changed_folders=$(git diff --name-only HEAD^ | grep -oP 'anda\/(.+)(\/|\$)' | 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"
- name: Generate build matrix
id: generate_build_matrix
run: |
anda ci >> $GITHUB_OUTPUT
build:
needs: manifest
strategy:
matrix:
pkg: ${{ fromJson(needs.manifest.outputs.build_matrix) }}
version: ["37"]
fail-fast: false
runs-on: ${{ matrix.pkg.arch == 'aarch64' && 'ARM64' || 'ubuntu-latest' }}
container:
image: ghcr.io/terrapkg/builder:main
options: --cap-add=SYS_ADMIN --privileged
steps:
- uses: terrapkg/anda-build@main
with:
name: "${{ matrix.pkg.pkg }}"
mockConfig: anda-${{ matrix.version }}-${{ matrix.pkg.arch }}
extraArgs: -D "sccache_bucket ${{secrets.SCCACHE_BUCKET}}" -D "sccache_endpoint ${{secrets.SCCACHE_ENDPOINT}}" -D "sccache_secret ${{secrets.SCCACHE_SECRET}}" -D "sccache_accesskey ${{secrets.SCCACHE_ACCESSKEY}}"
andaRepo: https://github.com/terrapkg/subatomic-repos/raw/main/terra${{ matrix.version }}.repo
- id: art
run: |
NAME=${{ matrix.pkg.pkg }}-${{ matrix.pkg.arch }}-${{ matrix.version }}
x=${NAME//\//@}
echo "name=$x" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v3
with:
name: ${{ steps.art.outputs.name }}
path: anda-build/rpm/rpms/*
- name: Upload packages to subatomic
if: github.event_name != 'pull_request'
run: |
subatomic-cli upload --prune \
--server https://subatomic.fyralabs.com \
--token ${{ secrets.SUBATOMIC_TOKEN }} \
terra${{ matrix.version }} anda-build/rpm/rpms/*