Skip to content

Commit

Permalink
fastlane Readme & corrections
Browse files Browse the repository at this point in the history
fastlane Readme & corrections

try fix for create alive

another fix to synch script
  • Loading branch information
mountrcg committed Apr 22, 2024
1 parent 6ab4a87 commit 2eddbed
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 11 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/build_iAPS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
- cron: '0 6 1 * *' # Builds the app on the 1st of every month at 06:00 UTC

env:
UPSTREAM_REPO: Artificial-Pancreas/iAPS
UPSTREAM_REPO: mountrcg/iAPS
UPSTREAM_BRANCH: ${{ github.ref_name }} # branch on upstream repository to sync from (replace with specific branch name if needed)
TARGET_BRANCH: ${{ github.ref_name }} # target branch on fork to be kept in sync, and target branch on upstream to be kept alive (replace with specific branch name if needed)
ALIVE_BRANCH: alive
Expand Down Expand Up @@ -69,21 +69,21 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Get ref for Artificial-Pancreas/iAPS:main
# Get ref for mountrcg/iAPS:autoISF
SHA=$(curl -sS https://api.github.com/repos/${{ env.UPSTREAM_REPO }}/git/refs \
| jq '.[] | select(.ref == "refs/heads/main" ) | .object.sha' \
| jq '.[] | select(.ref == "refs/heads/autoISF" ) | .object.sha' \
| tr -d '"'
);
# Create alive branch based on Artificial-Pancreas/iAPS:dev
# Create alive branch based on mountrcg/iAPS:autoISF
gh api \
--method POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
/repos/${{ github.repository_owner }}/iAPS/git/refs \
-f ref='refs/heads/alive' \
-f sha=$SHA
# Performs keepalive to avoid stale fork
check_latest_from_upstream:
needs: [validate, check_alive_and_permissions]
Expand All @@ -101,7 +101,7 @@ jobs:
with:
token: ${{ secrets.GH_PAT }}
ref: alive

# Keep repository "alive": add empty commits to ALIVE_BRANCH after "time_elapsed" days of inactivity to avoid inactivation of scheduled workflows
- name: Keep alive
if: |
Expand All @@ -116,7 +116,7 @@ jobs:
run: |
echo "### :calendar: Scheduled Sync and Build Disabled :mobile_phone_off:" >> $GITHUB_STEP_SUMMARY
echo "You have not yet configured the scheduled sync and build for iAPS's browser build." >> $GITHUB_STEP_SUMMARY
echo "Synchronizing your fork of <code>iAPS</code> with the upstream repository <code>Artificial-Pancreas/iAPS</code> will be skipped." >> $GITHUB_STEP_SUMMARY
echo "Synchronizing your fork of <code>iAPS</code> with the upstream repository <code>mountrcg/iAPS</code> will be skipped." >> $GITHUB_STEP_SUMMARY
echo "If you want to enable automatic builds and updates for your iAPS, please follow the instructions \
under the following path <code>iAPS/fastlane/testflight.md</code>." >> $GITHUB_STEP_SUMMARY
Expand Down Expand Up @@ -151,7 +151,7 @@ jobs:
- name: Sync upstream changes
if: | # do not run the upstream sync action on the upstream repository
needs.check_alive_and_permissions.outputs.WORKFLOW_PERMISSION == 'true' &&
vars.SCHEDULED_SYNC == 'true' && github.repository_owner != 'Artificial-Pancreas'
vars.SCHEDULED_SYNC == 'true' && github.repository_owner != 'mountrcg'
id: sync
uses: aormsby/[email protected]
with:
Expand Down
25 changes: 22 additions & 3 deletions fastlane/testflight.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ There are more detailed instructions in LoopDocs for doing Browser Builds of Loo

* A [github account](https://github.com/signup). The free level comes with plenty of storage and free compute time to build iAPS, multiple times a day, if you wanted to.
* A paid [Apple Developer account](https://developer.apple.com). You may be able to use the free version, but that has not been tested.
* Some time. Set aside a couple of hours to perform the setup.
* Some time. Set aside a couple of hours to perform the setup.
* Use the same GitHub account for all "Browser Builds" of the various DIY apps.


Expand All @@ -41,7 +41,8 @@ If you have previously built Loop or another app using the "browser build" metho
1. Create a [new personal access token](https://github.com/settings/tokens/new):
* Enter a name for your token. Something like "FastLane Access Token".
* The default Expiration time is 30 days - but you should select `No Expiration`
* Select the `repo` permission scope.
* Add a check beside the `workflow` permission scope
* A check will automatically appear in the repo scope as well - this is normal
* Click "Generate token".
* Copy the token and record it. It will be used below as `GH_PAT`.
1. In the forked iAPS repo, go to Settings -> Secrets -> Actions.
Expand All @@ -59,7 +60,7 @@ If you have previously built Loop or another app using the "browser build" metho
1. Select "1. Validate Secrets".
1. Click "Run Workflow", and tap the green button.
1. Wait, and within a minute or two you should see a green checkmark indicating the workflow succeeded.
1. The workflow will check if the required secrets are added and that they are correctly formatted. If errors are detected, please check the run log for details.
1. The workflow will check if the required secrets are added and that they are correctly formatted. If errors are detected, please check the run log for details.

## Add Identifiers for iAPS App

Expand Down Expand Up @@ -125,3 +126,21 @@ You do not need to fill out the next form. That is for submitting to the app sto
1. For each phone/person you would like to support iAPS on:
* Add them in [Users and Access](https://appstoreconnect.apple.com/access/users) on App Store Connect.
* Add them to your TestFlight Internal Testing group.

## Automatic Update & Build

For someone using development code for their own use, they probably want to decide when to update their fork to the most recent commit. They can still have the advantage of automatic building without automatic updates. Refer to [LoopDoc Automatic build](https://loopkit.github.io/loopdocs/gh-actions/automatic/) for detailed instructions.

### Disable Automatic Actions¶

To enable the scheduled build and sync, the GH_PAT must hold the workflow permission scopes. This permission serves as the enabler for automatic and scheduled builds with browser build. To disable this, follow these steps:

1. Go to your FastLane Access Token
1. If it says repo, workflow next to the FastLane Access Token link, then automatic building is enabled
1. To disable automatic update and build, click on the link to open the token detail view
* Click to uncheck the workflow box
* Click to check the repo box
1. Scroll all the way down to and click the green Update token button
1. Your token now holds only the repo permission

If you choose not to have automatic building enabled, be sure the GH_PAT has repo scope or you won't be able to manually build.

0 comments on commit 2eddbed

Please sign in to comment.