-
Notifications
You must be signed in to change notification settings - Fork 5
151 lines (133 loc) · 5.13 KB
/
gen2.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: Build and Release AppBundles - ng
on:
schedule:
- cron: '0 0 * * 0'
workflow_dispatch:
inputs:
script_pattern:
description: "Pattern to match scripts to build (leave empty to build all)"
required: false
default: ""
release:
description: "Create a release (true/false)"
required: false
default: "true"
jobs:
build:
name: Build and Release Packages
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 'stable'
- name: Prepare environment
run: |
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"
echo "GOBIN=$GOBIN" >> $GITHUB_ENV
- name: Build lib4bin
run: |
cd pelf/cmd/dynexec/lib4bin
go build -o "$GOBIN/lib4bin"
- name: Install tools
run: |
DBIN_PGRS="dwarfs-tools bwrap-patched sharun yq jq eget2"
wget -qO- "https://raw.githubusercontent.com/xplshn/dbin/master/stubdl" | sh -s -- --install "$GOBIN/dbin" add $DBIN_PGRS
PATH="$GOBIN:$PATH"
ln -sfT "$GOBIN/dwarfs-tools" "$GOBIN/mkdwarfs"
ln -sfT "$GOBIN/dwarfs-tools" "$GOBIN/dwarfs"
ln -sfT "$GOBIN/bwrap-patched" "$GOBIN/bwrap"
echo "PATH=$PATH" >> $GITHUB_ENV
- name: Select latest Edge Alpine rootfs
id: rootfs
run: |
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}"
echo "ROOTFS_URL=$ROOTFS_URL" >> $GITHUB_ENV
- name: Set OUT_DIR environment variable
run: |
OUT_DIR="${{ github.workspace }}/APPBUNDLES" # Store in workspace
mkdir -p "$OUT_DIR"
echo "OUT_DIR=${OUT_DIR}" >> $GITHUB_ENV
- name: Create pelf environment
run: |
cd "$OUT_DIR"
pelfCreator -m xplshn -n musl_C_Go_Fyne_DevEnv -p "fuse3 fuse build-base libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev linux-headers mesa-dev go git bash" -z -c -e "sh"
- name: List available scripts
run: |
echo "Listing available recipes:"
tree "${{ github.workspace }}/recipes"
- name: Run selected build scripts in OUT_DIR
run: |
cd $OUT_DIR
SCRIPT_PATTERN="${{ github.event.inputs.script_pattern }}"
if [ -z "$SCRIPT_PATTERN" ]; then
echo "No script pattern provided, running all scripts."
PATTERN=".*" # Match all scripts
else
echo "Pattern provided: $SCRIPT_PATTERN"
PATTERN="$SCRIPT_PATTERN"
fi
for script in "${{ github.workspace }}/recipes/"*/*.*sh; do
if echo "$script" | grep -E "$PATTERN"; then
echo "Running $script"
chmod +x "$script"
DEBUG=1 ./musl_C_Go_Fyne_DevEnv*.AppDir/AppRun "$script"
else
echo "Skipping $script (does not match pattern)"
fi
done
- name: List output
run: |
echo "Archiving output from $OUT_DIR"
ls "$OUT_DIR"
- name: Upload build artifacts
if: ${{ github.event.inputs.release == 'false' }} # Only upload artifacts if no release
uses: actions/upload-artifact@v4
with:
name: app-bundles
path: ${{ env.OUT_DIR }}/*.AppBundle
- name: Manage Tags
if: ${{ github.event.inputs.release == 'true' }} # Only manage tags for releases
run: |
git fetch --tags
TAGS=$(git tag | sort -V)
TAG_COUNT=$(echo "$TAGS" | wc -l)
if [ "$TAG_COUNT" -gt 5 ]; then
TAGS_TO_DELETE=$(echo "$TAGS" | head -n -1)
for TAG in $TAGS_TO_DELETE; do
echo "Deleting tag: $TAG"
git tag -d "$TAG"
git push origin --delete "$TAG"
done
else
echo "Tag count is $TAG_COUNT, no tags to delete."
fi
- name: Create Git Tag
if: ${{ github.event.inputs.release == 'true' }} # Only create tag for releases
run: |
TAG_NAME="v$(date +'%Y%m%d%H%M%S')" # Generate tag based on current timestamp
echo "Creating tag: $TAG_NAME"
git tag "$TAG_NAME"
git push origin "$TAG_NAME"
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
- name: Create Release
if: ${{ github.event.inputs.release == 'true' }} # Conditional release
uses: softprops/[email protected]
with:
name: "Weekly Release - ${{ env.TAG_NAME }}"
tag_name: "${{ env.TAG_NAME }}"
prerelease: false
draft: false
generate_release_notes: false
make_latest: true
files: |
${{ env.OUT_DIR }}/*.AppBundle
continue-on-error: true