-
-
Notifications
You must be signed in to change notification settings - Fork 31
132 lines (120 loc) · 3.73 KB
/
nightly.yml
File metadata and controls
132 lines (120 loc) · 3.73 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
122
123
124
125
126
127
128
129
130
131
132
name: Nightly Release
on:
workflow_dispatch:
schedule:
- cron: "0 15 * * *"
permissions:
contents: write
jobs:
check-activity:
name: Check repository activity
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.check_commits.outputs.should_run }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Check for recent commits
id: check_commits
run: |
LAST_COMMIT_TIMESTAMP=$(git log -1 --format=%ct)
NOW_TIMESTAMP=$(date +%s)
# If the last commit is older than 24 hours (86400 seconds), skip the build
if (( (NOW_TIMESTAMP - LAST_COMMIT_TIMESTAMP) > 86400 )); then
echo "No new commits in the last 24 hours. Skipping build."
echo "should_run=false" >> $GITHUB_OUTPUT
else
echo "New commits found. Proceeding with build."
echo "should_run=true" >> $GITHUB_OUTPUT
fi
build-android:
needs: check-activity
if: needs.check-activity.outputs.should_run == 'true'
uses: ./.github/workflows/android-build.yml
secrets: inherit
with:
flutter_version: ${{ vars.FLUTTER_VERSION }}
workflow_profile: nightly
build_mode: release_common
artifact_name: APK
enable_build_cache: true
enable_gradle_cache: true
signing_required: true
build-android-full:
needs: check-activity
if: needs.check-activity.outputs.should_run == 'true'
uses: ./.github/workflows/android-build.yml
secrets: inherit
with:
flutter_version: ${{ vars.FLUTTER_VERSION }}
workflow_profile: nightly
build_mode: release_full
artifact_name: APK-FULL
enable_build_cache: true
enable_gradle_cache: true
signing_required: true
build-windows:
needs: check-activity
if: needs.check-activity.outputs.should_run == 'true'
uses: ./.github/workflows/windows-build.yml
with:
flutter_version: ${{ vars.FLUTTER_VERSION }}
workflow_profile: nightly
artifact_name: Windows
enable_build_cache: true
package_release_artifacts: true
msix_skip_clean: true
build-linux:
needs: check-activity
if: needs.check-activity.outputs.should_run == 'true'
uses: ./.github/workflows/linux-build.yml
with:
flutter_version: ${{ vars.FLUTTER_VERSION }}
workflow_profile: nightly
artifact_name: Linux
package_release_artifacts: true
release:
name: Release
runs-on: ubuntu-latest
needs:
[
check-activity,
build-android,
build-android-full,
build-windows,
build-linux,
]
if: needs.check-activity.outputs.should_run == 'true'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Generate release body
id: release_body
run: |
cat <<EOF >> $GITHUB_OUTPUT
body<<DELIMITER
Latest commit: $(git log -1 --pretty=%s)
Commit hash: $(git rev-parse --short HEAD)
Build date: $(date -u +'%Y-%m-%dT%H:%M:%SZ')
DELIMITER
EOF
- name: Delete existing nightly release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release delete nightly --cleanup-tag -y || true
- uses: ncipollo/release-action@v1
with:
artifacts: "APK/ciyue-*-release.apk,APK-FULL/ciyue-*-full.apk,Windows/*,Linux/*"
tag: "nightly"
name: "Nightly Build"
body: ${{ steps.release_body.outputs.body }}
prerelease: true
allowUpdates: true
replacesArtifacts: true