Skip to content

Commit

Permalink
ci: add xcode build and analysis (#4)
Browse files Browse the repository at this point in the history
* ci: add xcode build and analysis

* ci: use mxcl/xcodebuild action

* ci: specify xcode build action

* build: use development signing capabilities

* ci: remove code sign identity

* ci: test apple dev team auto sign

* build: no build dev team

* build: remove code signer setting

* build: automatic apple dev signing

* ci: use code sign identity

* ci: use pod workspace setting

* ci: specify scheme for Xcode build

* ci: manually run pod install and xcode build

* ci: publish build assets to branch

* ci: copy build asset for publishing

* ci: écho debug output

* ci: fix setting publish dir env variable

* ci: zip generator before publishing

* ci: wip

* ci: document command for bundling distributable

create artifact from same folder path
  • Loading branch information
iamogbz authored Jul 7, 2023
1 parent 4fff9ff commit 5f0409c
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 10 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/xcode.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: xcode - build

on:
push:
branches: [ "main" ]
pull_request:

jobs:
build:
name: latest macos x
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install
uses: mxcl/xcodebuild@v2
with:
xcode: ^14
action: none
- name: Build
run: |
pod install
xcodebuild -configuration Debug -workspace QuickLookXD.xcworkspace -scheme QuickLookXD clean build -quiet
# Create variables to use in packaging
export BUNDLE_FILEPATH="$(xcodebuild -configuration Debug -workspace QuickLookXD.xcworkspace -scheme QuickLookXD -showBuildSettings 2>&1 | grep CODESIGNING_FOLDER_PATH | cut -d '=' -f2 | tr -d '[:space:]')"
export BUNDLE_PATH=$(dirname "${BUNDLE_FILEPATH}")
export BUNDLE_FILE=$(basename "${BUNDLE_FILEPATH}")
export PUBLISH_DIR="/tmp/quicklookxdist"
export PUBLISH_ZIP="bundle.zip"
# Enter the built generator bundle directory
echo "[${BUNDLE_PATH}]:"
cd "${BUNDLE_PATH}" && ls
# Archive the built generator as a zip file
echo "BUNDLE: ${BUNDLE_FILE} >>> ${PUBLISH_ZIP}"
zip -9qr "${PUBLISH_ZIP}" "${BUNDLE_FILE}"
echo "[$(pwd)]:" && ls "${PUBLISH_ZIP}"
# Ensure the directory to publish exists
echo "CREATE: ${PUBLISH_DIR}"
mkdir -p "${PUBLISH_DIR}"
# Move the bundle zip to the publish path
echo "MOVING: ${PUBLISH_ZIP} >>> ${PUBLISH_DIR}"
cp "${PUBLISH_ZIP}" "${PUBLISH_DIR}"
echo "[${PUBLISH_DIR}]:" && ls "${PUBLISH_DIR}"
# Make the packaging variables available
echo "BUNDLE_PATH=${BUNDLE_PATH}" >> "$GITHUB_ENV"
echo "BUNDLE_FILE=${BUNDLE_FILE}" >> "$GITHUB_ENV"
echo "PUBLISH_ZIP=${PUBLISH_ZIP}" >> "$GITHUB_ENV"
- uses: actions/upload-artifact@v3
with:
path: |
${{ env.BUNDLE_PATH }}/${{ env.BUNDLE_FILE }}
${{ env.BUNDLE_PATH }}/${{ env.PUBLISH_ZIP }}
retention-days: 13
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/main' && github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]'
with:
github_token: ${{ secrets.GH_TOKEN }}
publish_dir: ${{ env.PUBLISH_DIR }}
publish_branch: dist
destination_dir: ${{ github.sha }}
keep_files: true
15 changes: 8 additions & 7 deletions QuickLookXD.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
1497C4A72A55C6D2004C4C03 /* QuickLookUI.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 14CD3E322A552579001221C8 /* QuickLookUI.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
1497C4A82A55C6D3004C4C03 /* SSZipArchive.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 149F81532A5532B4003078F1 /* SSZipArchive.framework */; };
1497C4A92A55C6D3004C4C03 /* SSZipArchive.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 149F81532A5532B4003078F1 /* SSZipArchive.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
14B02F552A5762EE00E68578 /* .github in Resources */ = {isa = PBXBuildFile; fileRef = 14B02F542A5762EE00E68578 /* .github */; };
14F06C002A572C1C007D7E47 /* docs in Resources */ = {isa = PBXBuildFile; fileRef = 14F06BFF2A572C1C007D7E47 /* docs */; };
440BBDE80B0537AC0075B7E5 /* QuickLookXD.qlgenerator in Copy Files */ = {isa = PBXBuildFile; fileRef = 8D576316048677EA00EA77CD /* QuickLookXD.qlgenerator */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
8D5B49A804867FD3000E48DA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8D5B49A704867FD3000E48DA /* InfoPlist.strings */; };
Expand Down Expand Up @@ -67,6 +68,7 @@
1497C49C2A55C356004C4C03 /* Pods_QuickLookXD.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Pods_QuickLookXD.framework; path = "/Users/Emmanuel/Library/Developer/Xcode/DerivedData/QuickLookXD-anldcwhcionfhrehdwpudqytenml/Build/Products/Debug/Pods_QuickLookXD.framework"; sourceTree = "<absolute>"; };
149F81532A5532B4003078F1 /* SSZipArchive.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = SSZipArchive.framework; path = SSZipArchive/SSZipArchive.framework; sourceTree = BUILT_PRODUCTS_DIR; };
149F81602A55BE6B003078F1 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = /System/Library/Frameworks/CoreServices.framework; sourceTree = "<absolute>"; };
14B02F542A5762EE00E68578 /* .github */ = {isa = PBXFileReference; lastKnownFileType = folder; path = .github; sourceTree = "<group>"; };
14CD3E302A552562001221C8 /* QuickLookThumbnailing.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuickLookThumbnailing.framework; path = /System/Library/Frameworks/QuickLookThumbnailing.framework; sourceTree = "<absolute>"; };
14CD3E322A552579001221C8 /* QuickLookUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuickLookUI.framework; path = /System/Library/Frameworks/QuickLookUI.framework; sourceTree = "<absolute>"; };
14CD3E452A5529B2001221C8 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
Expand Down Expand Up @@ -131,6 +133,7 @@
089C167CFE841241C02AAC07 /* Resources */ = {
isa = PBXGroup;
children = (
14B02F542A5762EE00E68578 /* .github */,
14F06BFF2A572C1C007D7E47 /* docs */,
622150340BBDD60C00126F4B /* Info.plist */,
14F06C012A572C3C007D7E47 /* README.md */,
Expand Down Expand Up @@ -251,6 +254,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
14B02F552A5762EE00E68578 /* .github in Resources */,
8D5B49A804867FD3000E48DA /* InfoPlist.strings in Resources */,
14F06C002A572C1C007D7E47 /* docs in Resources */,
);
Expand Down Expand Up @@ -325,12 +329,11 @@
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = NO;
DEVELOPMENT_TEAM = 54HE8SFBAE;
DEVELOPMENT_TEAM = "";
EAGER_LINKING = YES;
FRAMEWORK_SEARCH_PATHS = (
"${inherited}",
Expand All @@ -347,7 +350,6 @@
LIBRARY_STYLE = Bundle;
MACOSX_BUILD_TARGET = 10.15;
MACOSX_DEPLOYMENT_TARGET = "${MACOSX_BUILD_TARGET}";
PLUGIN_ID = "74565352-F5FE-4DAD-9FDE-BF4791F600F8";
PRELINK_LIBS = SSZipArchive;
"PRELINK_LIBS[arch=*]" = SSZipArchive;
PRODUCT_BUNDLE_IDENTIFIER = com.qbrkts.quicklookxd;
Expand All @@ -367,10 +369,10 @@
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
DEAD_CODE_STRIPPING = NO;
DEVELOPMENT_TEAM = 54HE8SFBAE;
DEVELOPMENT_TEAM = "";
EAGER_LINKING = YES;
FRAMEWORK_SEARCH_PATHS = (
"${inherited}",
Expand All @@ -386,7 +388,6 @@
LIBRARY_STYLE = Bundle;
MACOSX_BUILD_TARGET = 10.15;
MACOSX_DEPLOYMENT_TARGET = "${MACOSX_BUILD_TARGET}";
PLUGIN_ID = "74565352-F5FE-4DAD-9FDE-BF4791F600F8";
PRELINK_LIBS = SSZipArchive;
PRODUCT_BUNDLE_IDENTIFIER = com.qbrkts.quicklookxd;
PRODUCT_NAME = QuickLookXD;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
<ActionContent
title = "Run Script"
scriptText = "# Refresh quicklook generators&#10;qlmanage -r&#10;">
scriptText = "# Refresh quicklook generators&#10;# qlmanage -r&#10;">
<EnvironmentBuildable>
<BuildableReference
BuildableIdentifier = "primary"
Expand Down Expand Up @@ -83,11 +83,11 @@
</CommandLineArgument>
<CommandLineArgument
argument = "-p"
isEnabled = "NO">
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "-t"
isEnabled = "YES">
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "${HOME}/Sources/github/iamogbz/macos-quick-look-plugin-adobe-xd/docs/example/file01.xd"
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ $ mdls -name kMDItemContentType ./docs/example/file01.xd
kMDItemContentType = "com.adobe.xd.project"
```

Testing the generated quick look bundle:

```sh
$ qlmanage -g QuickLookXD.qlgenerator -c com.adobe.xd.project -p document.xd
Testing Quick Look preview with files:
/path/to/document.xd
- force using content type UTI: com.adobe.xd.project
- force using generator at path: /tmp/quicklookxd/QuickLookXD.qlgenerator
```

## Demo

![Image showing list of XD files with thumbnails and preview](./docs/example/screenshot01.png)
Expand Down

0 comments on commit 5f0409c

Please sign in to comment.