Skip to content

Commit

Permalink
chore: Added GH Action xcodebuild-Demo.yml
Browse files Browse the repository at this point in the history
* Created GitHub Action `xcodebuild-Demo.yml` from Swift template.
* Added `on.workflow_call.secrets` section with declarations for:  
	⁃ `MAPBOX_SECRET_TOKEN`  
	⁃ `MAPBOX_ACCESS_TOKEN`  
	⁃ `XWEATHER_CLIENT_ID`  
	⁃ `XWEATHER_CLIENT_SECRET`
* Added “Setup Tokens” step after checkout to use secrets to configure `~/.netrc` (for `MAPBOX_SECRET_TOKEN`) and `./Demo/AccessKeys.plist` for everything else.
* Changed “Build” step to also build for platform iOS Simulator.  
	‣ In the future, it would be good to run UI/unit tests here, to ensure the app can launch & run.
  • Loading branch information
capnslipp authored and Slipp Douglas Thompson committed Aug 8, 2024
1 parent 09b6869 commit a170bb8
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/xcodebuild-Demo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# This workflow will build a Swift project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift

name: Swift

on:
workflow_call:
secrets:
MAPBOX_SECRET_TOKEN:
required: true
MAPBOX_ACCESS_TOKEN:
required: true
XWEATHER_CLIENT_ID:
required: true
XWEATHER_CLIENT_SECRET:
required: true
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:

runs-on: macos-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Setup Tokens
run: |
echo "machine api.mapbox.com login mapbox password ${{ secrets.MAPBOX_SECRET_TOKEN }}" >> ~/.netrc
chmod 0600 ~/.netrc
pushd ./Demo
cp ./AccessKeys-Sample.plist ./AccessKeys.plist
defaults write "$(realpath ./AccessKeys.plist)" 'MapboxAccessToken' -string "${{ secrets.MAPBOX_ACCESS_TOKEN }}"
defaults write "$(realpath ./AccessKeys.plist)" 'XweatherClientID' -string "${{ secrets.XWEATHER_CLIENT_ID }}"
defaults write "$(realpath ./AccessKeys.plist)" 'XweatherClientSecret' -string "${{ secrets.XWEATHER_CLIENT_SECRET }}"
popd
- name: Build for iOS
run: |
xcodebuild build \
-project ./Demo.xcodeproj \
-scheme 'Demo' \
-destination 'generic/platform=iOS'
- name: Build for iOS Simulator
run: |
xcodebuild build \
-project ./Demo.xcodeproj \
-scheme 'Demo' \
-destination 'generic/platform=iOS Simulator'

0 comments on commit a170bb8

Please sign in to comment.