Skip to content

Commit 6bb5ce6

Browse files
committed
Changes to build_loop.yml and update.yml:
build_loop.yml: -Remove sync action from build_loop.yml -build on schedule on the 1th every month for a predictable build schedule well within the 90 day TestFlight limit. The time of day should be chosen as a time where ongoing changes are unlikely during releases (nighttime). -rename env TARGET_BRANCH to BUILD_BRANCH - use current branch as BUILD_BRANCH for easy switching to building main or dev (manually insert alternative branch names as needed) update.yml: - check for updates every day - use current branch name for UPSTREAM_BRANCH and TARGET_BRANCH, to easily switch between dev and main by changing default branch, without any code changes. - do not run the upstream sync action on the upstream LoopKit repository - time_elapsed: 50 days for keepalive action
1 parent a23f291 commit 6bb5ce6

File tree

2 files changed

+14
-40
lines changed

2 files changed

+14
-40
lines changed

.github/workflows/build_loop.yml

Lines changed: 7 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@ on:
77
## Remove the "#" sign from the beginning of the line below to get automated builds on push (code changes in your repository)
88
#push:
99

10+
schedule:
11+
- cron: '30 04 1 * *' # Runs at 04:30 UTC on the 1st every month
12+
1013
env:
11-
UPSTREAM_REPO: LoopKit/LoopWorkspace
12-
UPSTREAM_BRANCH: main # upstream branch to sync from
13-
TARGET_BRANCH: main # branch on fork to build from
14-
SYNC_UPSTREAM: 'true' # set to 'false' or 'true' to disable / enable syncing of fork with upstream repository
14+
BUILD_BRANCH: ${{ github.ref_name }} # branch on fork to build from (relpace with specific branch name if needed)
1515

1616
jobs:
1717
secrets:
1818
name: Secrets
1919
uses: ./.github/workflows/validate_secrets.yml
2020
secrets: inherit
2121

22-
upstream_sync_and_build:
23-
name: Sync and build
22+
build:
23+
name: Build
2424
needs: secrets
2525
runs-on: macos-12
2626
steps:
@@ -33,34 +33,7 @@ jobs:
3333
uses: actions/checkout@v3
3434
with:
3535
submodules: recursive
36-
ref: ${{ env.TARGET_BRANCH }}
37-
38-
# Run the sync action
39-
- name: Sync upstream changes
40-
if: ${{ env.SYNC_UPSTREAM == 'true' }}
41-
id: sync
42-
uses: aormsby/[email protected]
43-
with:
44-
target_sync_branch: ${{ env.TARGET_BRANCH }}
45-
target_branch_checkout_args: --recurse-submodules
46-
shallow_since: 6 months ago
47-
# REQUIRED 'target_repo_token' exactly like this!
48-
target_repo_token: ${{ secrets.GH_PAT }}
49-
upstream_sync_branch: ${{ env.UPSTREAM_BRANCH }}
50-
upstream_sync_repo: ${{ env.UPSTREAM_REPO }}
51-
# upstream_repo_access_token: ${{ secrets.UPSTREAM_REPO_SECRET }}
52-
53-
# Step 3: Display a sample message based on the sync output var 'has_new_commits'
54-
- name: New commits found
55-
if: steps.sync.outputs.has_new_commits == 'true'
56-
run: echo "New commits were found to sync."
57-
58-
- name: No new commits
59-
if: steps.sync.outputs.has_new_commits == 'false'
60-
run: echo "There were no new commits."
61-
62-
- name: Show value of 'has_new_commits'
63-
run: echo ${{ steps.sync.outputs.has_new_commits }}
36+
ref: ${{ env.BUILD_BRANCH }}
6437

6538
# Customize Loop: Download and apply patches
6639
- name: Customize Loop

.github/workflows/update.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ name: 'Auto-update'
1010
on:
1111
workflow_dispatch:
1212
schedule:
13-
- cron: '0 7 * * 1,4'
14-
# scheduled at 07:00 every Monday and Thursday
13+
- cron: '0 04 * * *'
14+
# scheduled at 04:00 every day
1515

1616
env:
1717
UPSTREAM_REPO: LoopKit/LoopWorkspace
18-
UPSTREAM_BRANCH: main
19-
TARGET_BRANCH: actions # target branch on fork to be kept "alive" for running scheduled workflows (repo activity required at least every 60 days for scheduled workflows to remain active)
20-
18+
UPSTREAM_BRANCH: ${{ github.ref_name }} # branch on upstream repository to sync from (relpace with specific branch name if needed)
19+
TARGET_BRANCH: ${{ github.ref_name }} # target branch on fork to be kept in sync, and target branch on upstream to be kept alive (relpace with specific branch name if needed)
20+
2121
jobs:
2222
check_latest_from_upstream:
2323
runs-on: ubuntu-latest
@@ -39,6 +39,7 @@ jobs:
3939
# REQUIRED step
4040
# Step 2: run the sync action
4141
- name: Sync upstream changes
42+
if: github.repository_owner != 'LoopKit' # do not run the upstream sync action on the upstream repository
4243
id: sync
4344
uses: aormsby/[email protected]
4445
with:
@@ -69,7 +70,7 @@ jobs:
6970
if: github.ref == 'refs/heads/${{ env.TARGET_BRANCH }}'
7071
uses: gautamkrishnar/keepalive-workflow@v1 # using the workflow with default settings
7172
with:
72-
time_elapsed: 27 # Time elapsed from the previous commit to trigger a new automated commit (in days)
73+
time_elapsed: 50 # Time elapsed from the previous commit to trigger a new automated commit (in days)
7374

7475
# Launch build workflow if new commits are found
7576
launch_build_workflow:

0 commit comments

Comments
 (0)