-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from andrewn/chore/xcode-action
Build app using github actions
- Loading branch information
Showing
2 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
name: Build macOS App | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
tags: | ||
- "v*" # This will trigger the workflow on push of tags starting with 'v' | ||
pull_request: | ||
branches: [main] | ||
|
||
env: | ||
PROJECT_NAME: BrewServicesMenubar | ||
SCHEME_NAME: BrewServicesMenubar | ||
XCODE_VERSION: 15.4 | ||
|
||
jobs: | ||
build: | ||
runs-on: macos-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Select Xcode | ||
run: sudo xcode-select -s /Applications/Xcode_${XCODE_VERSION}.app | ||
|
||
- name: Cache Swift packages | ||
uses: actions/cache@v4 | ||
with: | ||
path: .build | ||
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }} | ||
restore-keys: | | ||
${{ runner.os }}-spm- | ||
- name: Build | ||
run: | | ||
xcodebuild clean build -project ${PROJECT_NAME}.xcodeproj -scheme ${SCHEME_NAME} -destination 'platform=macOS' | ||
- name: Archive app | ||
run: | | ||
xcodebuild -project ${PROJECT_NAME}.xcodeproj -scheme ${SCHEME_NAME} -configuration Release archive -archivePath $PWD/build/${PROJECT_NAME}.xcarchive | ||
- name: Export app | ||
run: | | ||
xcodebuild -exportArchive -archivePath $PWD/build/${PROJECT_NAME}.xcarchive -exportOptionsPlist ExportOptions.plist -exportPath $PWD/build | ||
- name: Get version | ||
id: get_version | ||
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | ||
if: startsWith(github.ref, 'refs/tags/') | ||
|
||
- name: Zip .app for upload | ||
run: | | ||
cd $PWD/build | ||
if [[ $GITHUB_REF == refs/tags/* ]]; then | ||
zip -r ${{ env.PROJECT_NAME }}-${{ steps.get_version.outputs.VERSION }}.zip ${{ env.PROJECT_NAME }}.app | ||
else | ||
zip -r ${{ env.PROJECT_NAME }}.zip ${{ env.PROJECT_NAME }}.app | ||
fi | ||
echo "ZIP_FILE=${{ env.PROJECT_NAME }}${{ startsWith(github.ref, 'refs/tags/') && format('-{0}', steps.get_version.outputs.VERSION) || '' }}.zip" >> $GITHUB_ENV | ||
ls -la # Debug: List contents of current directory | ||
- name: Debug - List build directory | ||
run: | | ||
echo "Contents of $PWD/build:" | ||
ls -R $PWD/build | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ env.PROJECT_NAME }} | ||
path: ${{ github.workspace }}/build/${{ env.ZIP_FILE }} | ||
if: success() | ||
|
||
- name: Upload build directory (for debugging) | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: build-directory-contents | ||
path: $PWD/build | ||
if: failure() | ||
|
||
- name: Create Release | ||
if: startsWith(github.ref, 'refs/tags/') | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
files: ${{ github.workspace }}/build/${{ env.ZIP_FILE }} | ||
draft: false | ||
prerelease: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>method</key> | ||
<string>mac-application</string> | ||
<key>teamID</key> | ||
<string>PS3M4R7DP9</string> | ||
<key>signingStyle</key> | ||
<string>automatic</string> | ||
<key>stripSwiftSymbols</key> | ||
<true /> | ||
<key>uploadSymbols</key> | ||
<true /> | ||
<key>uploadBitcode</key> | ||
<false /> | ||
</dict> | ||
</plist> |