-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (78 loc) · 2.54 KB
/
build-git-packages.yml
File metadata and controls
83 lines (78 loc) · 2.54 KB
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
name: Build Development Packages
on:
push:
branches: [ main ]
paths:
- '*-git/**'
schedule:
- cron: 0 0 * * 0,3
workflow_dispatch:
jobs:
discover:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.mk.outputs.matrix }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0 # needed for reliable diffs on push
# On push: compute changed root dirs
- name: Changed root dirs (push only)
id: changed
if: github.event_name == 'push'
uses: tj-actions/changed-files@v47
with:
# Return directories instead of files. [page:3]
dir_names: "true"
# Only consider actual root subdirs by limiting depth to 1 (e.g. "apps/foo" -> "apps"). [page:3]
dir_names_max_depth: "1"
# Exclude '.' which means "repo root" when root files changed. [page:3]
dir_names_exclude_current_dir: "true"
# Make output JSON so it can be used as a matrix. [page:3]
json: "true"
escape_json: "false"
files: '*-git/**'
# On manual: enumerate all root dirs
- name: All root dirs (manual only)
id: all
if: github.event_name != 'push'
shell: bash
run: |
set -euo pipefail
dirs="$(
find . -mindepth 1 -maxdepth 1 -type d \
-path './*-git' \
-printf '%f\n' | sort -u \
| jq -Rsc 'split("\n") | map(select(length>0))'
)"
echo "dirs=$dirs" >> "$GITHUB_OUTPUT"
- name: Build matrix
id: mk
shell: bash
run: |
set -euo pipefail
if [[ "${{ github.event_name }}" == "push" ]]; then
# tj-actions outputs JSON array (because json=true, escape_json=false).
dirs='${{ steps.changed.outputs.all_changed_files }}'
else
dirs='${{ steps.all.outputs.dirs }}'
fi
echo "matrix=$(jq -nc --argjson d "$dirs" '{dir: $d}')" >> "$GITHUB_OUTPUT"
build:
needs: discover
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.discover.outputs.matrix) }}
steps:
- uses: actions/checkout@v6
- name: Build package
uses: Alto1772/arch-pkgbuild-builder@94308635315e36ccdde50ddc2327e244419590da
with:
target: pkgbuild
pkgname: ${{ matrix.dir }}
- name: Upload package
uses: actions/upload-artifact@v6
with:
name: ${{ matrix.dir }}
path: ${{ matrix.dir }}/*.pkg.tar.zst