-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (109 loc) · 4.1 KB
/
Copy pathci.yml
File metadata and controls
121 lines (109 loc) · 4.1 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
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
name: CI
on:
workflow_dispatch:
inputs:
force_build:
description: 'Build even when HEAD already matches the nightly tag'
type: boolean
default: false
schedule:
# Run after the Lazarus Unleashed nightly so both FPC and Lazarus
# bundles are fresh (FPC: 00:00 UTC, Lazarus: 01:00 UTC).
- cron: '0 2 * * *'
jobs:
check-for-changes:
runs-on: ubuntu-latest
outputs:
should_build: ${{ steps.check.outputs.should_build }}
steps:
- name: Checkout HEAD only
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Fetch 'nightly' tag only
run: git fetch origin refs/tags/nightly:refs/tags/nightly || true
- name: Check for changes since nightly
id: check
run: |
if [ "${{ inputs.force_build }}" = "true" ]; then
echo "force_build requested, skipping commit comparison"
echo "should_build=true" >> $GITHUB_OUTPUT
exit 0
fi
if git rev-parse nightly >/dev/null 2>&1; then
nightly_commit=$(git rev-list -n 1 nightly)
head_commit=$(git rev-parse HEAD)
echo "Nightly tag commit: $nightly_commit"
echo "HEAD commit: $head_commit"
if [ "$nightly_commit" = "$head_commit" ]; then
echo "No new commits since nightly release"
echo "should_build=false" >> $GITHUB_OUTPUT
else
echo "New commits found since nightly release"
echo "should_build=true" >> $GITHUB_OUTPUT
fi
else
echo "No 'nightly' tag found - will build"
echo "should_build=true" >> $GITHUB_OUTPUT
fi
windows:
needs: check-for-changes
if: needs.check-for-changes.outputs.should_build == 'true'
uses: ./.github/workflows/windows.yml
linux:
needs: check-for-changes
if: needs.check-for-changes.outputs.should_build == 'true'
uses: ./.github/workflows/linux.yml
release:
needs: [windows, linux]
if: needs.windows.result == 'success' && needs.linux.result == 'success'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout installer source
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Download installer_win64_x86_64.exe
uses: actions/download-artifact@v4
with:
name: installer_win64_x86_64.exe
- name: Download installer_linux_x86_64
uses: actions/download-artifact@v4
with:
name: installer_linux_x86_64
- name: Download installer_linux_x86_64.AppImage
uses: actions/download-artifact@v4
with:
name: installer_linux_x86_64.AppImage
- name: Prepare release notes
run: |
ts=$(TZ=Europe/Berlin date +"%Y-%m-%d %H:%M:%S CEST")
# maj/min/rev come from the committed .lpi; BuildNr is the GH run number
# (same value the builds bumped into their copies before compiling).
maj=$(grep -oP '<MajorVersionNr Value="\K[0-9]+' src/installer.lpi || echo 0)
min=$(grep -oP '<MinorVersionNr Value="\K[0-9]+' src/installer.lpi || echo 0)
rev=$(grep -oP '<RevisionNr Value="\K[0-9]+' src/installer.lpi || echo 0)
ver="${maj}.${min}.${rev}.${GITHUB_RUN_NUMBER}"
{
echo "Unleashed Installer nightly build"
echo
echo "Generated from commit: $GITHUB_SHA"
echo "Build time: $ts"
echo "Version: $ver"
} > release-body.txt
- name: Publish nightly release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release delete nightly --yes --cleanup-tag --repo "$GITHUB_REPOSITORY" 2>/dev/null || true
gh release create nightly \
--repo "$GITHUB_REPOSITORY" \
--target "$GITHUB_SHA" \
--title "Unleashed Installer nightly" \
--notes-file release-body.txt \
--prerelease \
installer_win64_x86_64.exe \
installer_linux_x86_64 \
installer_linux_x86_64.AppImage