Skip to content

Commit e3d4ad7

Browse files
committed
Add scheduled runs for build workflow
This will provide automated weekly builds, only if there are new commits. Issue #265
1 parent 995cee1 commit e3d4ad7

File tree

3 files changed

+46
-2
lines changed

3 files changed

+46
-2
lines changed

.github/workflows/build.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,48 @@ on:
55
push:
66
tags:
77
- v**
8+
schedule:
9+
- cron: '37 2 * * 0'
810

911
concurrency:
1012
group: ${{ github.workflow }}-${{ github.ref }}
1113
cancel-in-progress: true
1214

1315
jobs:
16+
check-commits:
17+
runs-on: ubuntu-latest
18+
outputs:
19+
should_run: ${{ steps.check.outputs.should_run }}
20+
steps:
21+
- uses: actions/checkout@v3
22+
23+
- name: Install GitHub CLI
24+
run: sudo apt-get update && sudo apt-get install -y gh
25+
26+
- name: Check for new commits since last successful run
27+
id: check
28+
run: |
29+
if [ "${{ github.event_name }}" != "schedule" ]; then
30+
echo "should_run=true" >> $GITHUB_OUTPUT
31+
exit 0
32+
fi
33+
LAST_SUCCESS=$(gh run list --workflow build.yml --branch ${{ github.ref_name }} --status success --limit 1 --json startedAt --jq '.[0].startedAt')
34+
if [ -z "$LAST_SUCCESS" ]; then
35+
echo "No previous successful run, continuing."
36+
echo "should_run=true" >> $GITHUB_OUTPUT
37+
exit 0
38+
fi
39+
NEW_COMMITS=$(git rev-list --count --since="$LAST_SUCCESS" ${{ github.ref_name }})
40+
if [ "$NEW_COMMITS" -eq 0 ]; then
41+
echo "No new commits since last successful run, skipping workflow."
42+
echo "should_run=false" >> $GITHUB_OUTPUT
43+
exit 0
44+
fi
45+
echo "should_run=true" >> $GITHUB_OUTPUT
46+
1447
download-dbip:
48+
needs: check-commits
49+
if: needs.check-commits.outputs.should_run == 'true'
1550
runs-on: ubuntu-latest
1651
steps:
1752
- uses: actions/checkout@v3

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ Planned:
3434

3535
Transmission v2.40 or later is required.
3636

37+
## Downloads
38+
39+
You can get the latest release from the
40+
[releases page](https://github.com/openscopeproject/TrguiNG/releases).
41+
42+
Weekly builds of current development version are available from github
43+
[build workflows](https://github.com/openscopeproject/TrguiNG/actions/workflows/build.yml).
44+
Pick the latest successful run and scroll down to the artifacts section.
45+
3746
## Compiling
3847

3948
Prerequisites:

ci/fetch_latest_dbip.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ url_last_month="https://download.db-ip.com/free/dbip-country-lite-$last_month.mm
99
output_file="dbip-country-lite.mmdb.gz"
1010

1111
echo "Trying to download today's DB-IP file..."
12-
wget -O "$output_file" "$url_today"
12+
wget -q -O "$output_file" "$url_today"
1313
if [ $? -eq 0 ]; then
1414
echo "Downloaded today's file successfully."
1515
else
1616
echo "Today's file not available. Trying last month's file..."
17-
wget -O "$output_file" "$url_last_month"
17+
wget -q -O "$output_file" "$url_last_month"
1818
if [ $? -eq 0 ]; then
1919
echo "Downloaded last month's file successfully."
2020
else

0 commit comments

Comments
 (0)