-
Notifications
You must be signed in to change notification settings - Fork 5
131 lines (107 loc) · 4.35 KB
/
gen.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Build and Release Packages
on:
schedule:
- cron: '0 0 * * 0'
workflow_dispatch:
jobs:
build:
name: Build and Release Packages
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 'stable'
# Find and run all build scripts inside ./programs/*
- name: Run build scripts for all architectures
id: build_step
run: |
# Set output directory
OUT_DIR="$HOME/out"
mkdir -p "$OUT_DIR"
cd ${{ github.workspace }}
DBIN_PGRS="dwarfs-tools bwrap-patched sharun yq jq"
export GOBIN="$HOME/.local/bin"
mkdir -p "$GOBIN"
git clone --depth 1 --branch dev https://github.com/xplshn/pelf
cp ./pelf/pelf* "$GOBIN"
cp ./pelf/cmd/misc/* "$GOBIN"
cd pelf/cmd/pelfd
go build -o "$GOBIN/pelfd"
cd ../dynexec/lib4bin
go build -o "$GOBIN/lib4bin"
wget -qO- "https://raw.githubusercontent.com/xplshn/dbin/master/stubdl" | sh -s -- --install "$GOBIN/dbin" add $DBIN_PGRS && \
export PATH="$GOBIN:$PATH" && {
ln -sfT "$GOBIN/dwarfs-tools" "$GOBIN/mkdwarfs"
ln -sfT "$GOBIN/dwarfs-tools" "$GOBIN/dwarfs"
ln -sfT "$GOBIN/bwrap-patched" "$GOBIN/bwrap"
}
cd ${{ github.workspace }}
ROOTFS_URL="$(curl -qsL https://dl-cdn.alpinelinux.org/alpine/edge/releases/x86_64/latest-releases.yaml | yq '.[0].file')"
ROOTFS_URL="https://dl-cdn.alpinelinux.org/alpine/edge/releases/$(uname -m)/${ROOTFS_URL}"
export ROOTFS_URL
pelfCreator -m xplshn -n devEnv -p "fuse3 build-base go git" -z -c
devEnv="$(echo ${{ github.workspace }}/devEnv*/AppRun)"
cd "$OUT_DIR"
# Check if the recipes directory exists
if [ -d "${{ github.workspace }}/recipes" ]; then
echo "Listing contents of ./recipes:"
ls -l "${{ github.workspace }}/recipes/"
# Iterate over build scripts in recipes/*
for dir in "${{ github.workspace }}/recipes/"*; do
if [ -d "$dir" ]; then
for script in "$dir"/*.*sh; do # Target files ending in .sh
# Check if the script exists before making it executable
if [ -e "$script" ]; then
echo "Making $script executable..."
chmod +x "$script"
echo "Running $script..."
"${devEnv}" "$script"
else
echo "$script does not exist, skipping."
fi
done
else
echo "$dir is not a directory, skipping."
fi
done
else
echo "No recipes directory found, skipping."
fi
ls "$OUT_DIR"
# Set the output for the OUT_DIR variable
echo "OUT_DIR=${OUT_DIR}" >> $GITHUB_ENV
continue-on-error: true
# Remove older tags if more than 5 exist
- name: Manage Tags
run: |
# Fetch all tags
git fetch --tags
# Get the list of tags and count them
TAGS=$(git tag | sort -V) # Sort tags in version order
TAG_COUNT=$(echo "$TAGS" | wc -l)
if [ "$TAG_COUNT" -gt 5 ]; then
# Get the tags to delete (all except the latest)
TAGS_TO_DELETE=$(echo "$TAGS" | head -n -1) # All but the last tag
# Delete each old tag
for TAG in $TAGS_TO_DELETE; do
echo "Deleting tag: $TAG"
git tag -d "$TAG" || echo "Tag $TAG could not be deleted locally."
git push origin --delete "$TAG" || echo "Tag $TAG could not be deleted from remote."
done
else
echo "Tag count is $TAG_COUNT, no tags to delete."
fi
# Create GitHub Release
- name: Create Release
uses: marvinpinto/action-automatic-releases@latest
with:
title: "Weekly Release - Run ${{ github.run_id }}"
automatic_release_tag: weekly-release-${{ github.run_id }}
prerelease: false
draft: false
files: |
${{ env.OUT_DIR }}/*.AppBundle
repo_token: ${{ secrets.GITHUB_TOKEN }}