Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3e07954

Browse files
committed
added some local helpers and reactivated ci workflows
Change-Id: Ie0ecd24e63f5d015f3375c2853829c4646df16a6Signed-off-by: Thomas Kosiewski <tk@coder.com>
1 parentbabb49e commit3e07954

File tree

7 files changed

+148
-63
lines changed

7 files changed

+148
-63
lines changed

‎.github/actions/nix-devshell/action.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,5 @@ runs:
66
-name:Setup Nix
77
uses:DeterminateSystems/nix-installer-action@e50d5f73bfe71c2dd0aa4218de8f4afa59f8f81d# v16
88

9-
-name:Setup GHA Nix cache
10-
uses:DeterminateSystems/magic-nix-cache-action@6221693898146dc97e38ad0e013488a16477a4c4# v9
11-
129
-name:Enter devshell
1310
uses:nicknovitski/nix-develop@9be7cfb4b10451d3390a75dc18ad0465bed4932a# v1.2.1

‎.github/dependabot.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version:2
2+
updates:
3+
-package-ecosystem:"github-actions"
4+
directory:"/"
5+
schedule:
6+
interval:"weekly"
7+
time:"06:00"
8+
timezone:"America/Chicago"
9+
labels:[]
10+
commit-message:
11+
prefix:"ci"
12+
groups:
13+
github-actions:
14+
patterns:
15+
-"*"

‎.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ jobs:
1717
test:
1818
name:test
1919
runs-on:${{ github.repository_owner == 'coder' && 'depot-macos-latest' || 'macos-latest'}}
20-
if:false
2120
steps:
2221
-name:Checkout
2322
uses:actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683# v4.2.2
2423
with:
2524
fetch-depth:1
25+
persist-credentials:false
2626

2727
-name:Switch XCode Version
2828
uses:maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd# v1.6.0
@@ -39,12 +39,12 @@ jobs:
3939
format:
4040
name:fmt
4141
runs-on:${{ github.repository_owner == 'coder' && 'depot-macos-latest' || 'macos-latest'}}
42-
if:false
4342
steps:
4443
-name:Checkout
4544
uses:actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683# v4.2.2
4645
with:
4746
fetch-depth:1
47+
persist-credentials:false
4848

4949
-name:Switch XCode Version
5050
uses:maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd# v1.6.0
@@ -61,12 +61,12 @@ jobs:
6161
lint:
6262
name:lint
6363
runs-on:${{ github.repository_owner == 'coder' && 'depot-macos-latest' || 'macos-latest'}}
64-
if:false
6564
steps:
6665
-name:Checkout
6766
uses:actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683# v4.2.2
6867
with:
6968
fetch-depth:1
69+
persist-credentials:false
7070

7171
-name:Setup Nix
7272
uses:./.github/actions/nix-devshell

‎.github/workflows/release.yml

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,73 +2,74 @@ name: release
22

33
on:
44
# TODO: Switch to on `v*` tag push
5-
workflow_dispatch:
5+
pull_request:
66

7-
# permissions:
8-
# # To upload assets to the release
9-
# contents: write
7+
permissions:{}
108

119
jobs:
1210
build:
1311
runs-on:${{ github.repository_owner == 'coder' && 'depot-macos-latest' || 'macos-latest'}}
1412
if:${{ github.repository_owner == 'coder' }}
15-
env:
16-
CERT_PATH:/tmp/apple_cert.p12
17-
APP_PROF_PATH:/tmp/app.provisionprofile
18-
EXT_PROF_PATH:/tmp/ext.provisionprofile
19-
KEYCHAIN_PATH:/tmp/app-signing.keychain-db
13+
permissions:
14+
# To upload assets to the release
15+
contents:write
16+
env:
17+
KEYCHAIN_PATH:/tmp/app-signing.keychain-db
2018
steps:
2119
-name:Checkout
2220
uses:actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683# v4.2.2
2321
with:
2422
fetch-depth:1
23+
persist-credentials:false
2524

2625
-name:Switch XCode Version
2726
uses:maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd# v1.6.0
2827
with:
2928
xcode-version:"16.0.0"
3029

31-
-name:Install Cert & Retrieve Provisioning Profiles
30+
-name:Setup Nix
31+
uses:./.github/actions/nix-devshell
32+
33+
# FIXME(ThomasK33): Only used for testing, shall be removed later
34+
-name:Setup tmate session
35+
uses:mxschmitt/action-tmate@v3
36+
with:
37+
limit-access-to-actor:true
3238
env:
3339
APPLE_CERT:${{ secrets.APPLE_DEVELOPER_ID_PKCS12_B64 }}
3440
CERT_PASSWORD:${{ secrets.APPLE_DEVELOPER_ID_PKCS12_PASSWORD }}
41+
APPLE_ID:${{ secrets.APPLE_NOTARYTOOL_USERNAME }}
42+
APPLE_ID_PASSWORD:${{ secrets.APPLE_NOTARYTOOL_PASSWORD }}
3543
APP_PROF:${{ secrets.CODER_DESKTOP_APP_PROVISIONPROFILE_B64 }}
3644
EXT_PROF:${{ secrets.CODER_DESKTOP_EXTENSION_PROVISIONPROFILE_B64 }}
45+
46+
-name:Install Cert & Retrieve Provisioning Profiles
47+
env:
48+
APPLE_CERT:${{ secrets.APPLE_DEVELOPER_ID_PKCS12_B64 }}
49+
CERT_PASSWORD:${{ secrets.APPLE_DEVELOPER_ID_PKCS12_PASSWORD }}
3750
run:|
38-
set -euo pipefail
39-
touch "$CERT_PATH" "$APP_PROF_PATH" "$EXT_PROF_PATH"
40-
echo "$APPLE_CERT" | base64 -d > "$CERT_PATH"
41-
echo "$APP_PROF" | base64 -d > "$APP_PROF_PATH"
42-
echo "$EXT_PROF" | base64 -d > "$EXT_PROF_PATH"
43-
set -x
51+
set -euox pipefail
4452
security create-keychain -p "" "$KEYCHAIN_PATH"
4553
security set-keychain-settings -lut 21600 "$KEYCHAIN_PATH"
4654
security unlock-keychain -p "" "$KEYCHAIN_PATH"
47-
security import"$CERT_PATH" -P "$CERT_PASSWORD" -A -t cert -f pkcs12 -k "$KEYCHAIN_PATH"
55+
security import<(echo -n "$APPLE_CERT" | base64 -d) -P "$CERT_PASSWORD" -A -t cert -f pkcs12 -k "$KEYCHAIN_PATH"
4856
security list-keychain -d user -s "$KEYCHAIN_PATH"
4957
50-
-name:Setup Deps
51-
run:|
52-
brew install xcodegen
53-
npm install --global create-dmg
54-
5558
-name:Build
5659
env:
5760
APPLE_ID:${{ secrets.APPLE_NOTARYTOOL_USERNAME }}
5861
APPLE_ID_PASSWORD:${{ secrets.APPLE_NOTARYTOOL_PASSWORD }}
59-
run:|
60-
./scripts/build.sh
61-
62+
APP_PROF:${{ secrets.CODER_DESKTOP_APP_PROVISIONPROFILE_B64 }}
63+
EXT_PROF:${{ secrets.CODER_DESKTOP_EXTENSION_PROVISIONPROFILE_B64 }}
64+
run:./scripts/build.sh \
65+
--app-prof-path <(echo -n "$APP_PROF" | base64 -d) \
66+
--ext-prof-path <(echo -n "$EXT_PROF" | base64 -d) \
67+
--keychain-path "$KEYCHAIN_PATH"
68+
6269
-name:Upload Build Artifacts
6370
uses:actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08# v4.6.0
6471
with:
6572
name:app
6673
path:|
6774
./build
6875
retention-days:7
69-
70-
-name:Clean Up
71-
if:always()
72-
run:|
73-
security delete-keychain "$KEYCHAIN_PATH"
74-
rm -f /tmp/{apple_cert.p12,app.provisionprofile,ext.provisionprofile,app-signing.keychain-db}

‎Makefile

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ PROJECT := Coder\ Desktop
1010
XCPROJECT := Coder\ Desktop/Coder\ Desktop.xcodeproj
1111
SCHEME := Coder\ Desktop
1212
SWIFT_VERSION := 6.0
13+
APP_SIGNING_KEYCHAIN := app-signing.keychain-db
1314

1415
.PHONY: setup
1516
setup:\
@@ -27,6 +28,14 @@ $(XCPROJECT): $(PROJECT)/project.yml
2728
$(PROJECT)/VPNLib/vpn.pb.swift:$(PROJECT)/VPNLib/vpn.proto
2829
protoc --swift_opt=Visibility=public --swift_out=.'Coder Desktop/VPNLib/vpn.proto'
2930

31+
.PHONY:$(APP_SIGNING_KEYCHAIN)
32+
$(APP_SIGNING_KEYCHAIN):
33+
security create-keychain -p"""$(APP_SIGNING_KEYCHAIN)"
34+
security set-keychain-settings -lut 21600"$(APP_SIGNING_KEYCHAIN)"
35+
security unlock-keychain -p"""$(APP_SIGNING_KEYCHAIN)"
36+
security import<(echo -n"${APPLE_CERT}"| base64 -d) -P"${CERT_PASSWORD}" -A -t cert -f pkcs12 -k"$(APP_SIGNING_KEYCHAIN)"
37+
security list-keychain -d user -s"$(APP_SIGNING_KEYCHAIN)"
38+
3039
.PHONY: fmt
3140
fmt:## Run Swift file formatter
3241
swiftformat\
@@ -44,11 +53,19 @@ test: $(XCPROJECT) ## Run all tests
4453
CODE_SIGNING_ALLOWED=NO| xcbeautify
4554

4655
.PHONY: lint
47-
lint:## Lint swift files
56+
lint: lint/swift lint/actions## Lint all files in the repo
57+
58+
.PHONY: lint/swift
59+
lint/swift:## Lint Swift files
4860
swiftlint\
4961
--strict\
5062
--quiet$(LINTFLAGS)
5163

64+
.PHONY: lint/actions
65+
lint/actions:## Lint GitHub Actions
66+
actionlint
67+
zizmor.
68+
5269
.PHONY: clean
5370
clean:## Clean Xcode project
5471
xcodebuild clean\

‎flake.nix

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,22 @@
3131

3232
devShells.default=pkgs.mkShellNoCC{
3333
buildInputs=withpkgs;[
34+
actionlint
3435
apple-sdk_15
3536
clang
37+
coreutils
38+
create-dmg
3639
formatter
3740
gnumake
3841
protobuf_28
3942
protoc-gen-swift
4043
swiftformat
4144
swiftlint
4245
watchexec
43-
xcodegen
4446
xcbeautify
47+
xcodegen
48+
xcpretty
49+
zizmor
4550
];
4651
};
4752
}

‎scripts/build.sh

Lines changed: 74 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,67 @@
11
#!/usr/bin/env bash
2+
set -euo pipefail
23

3-
set -euxo pipefail
4+
# Build Documentation @ https://developer.apple.com/forums/thread/737894
5+
APPLE_TEAM_ID="4399GN35BJ"
6+
CODE_SIGN_IDENTITY="Developer ID Application: Coder Technologies Inc (${APPLE_TEAM_ID})"
47

5-
get_uuid() {
6-
strings"$1"| grep -E -o'[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}'
8+
# Default values pulled in from env
9+
APP_PROF_PATH=${APP_PROF_PATH:-""}
10+
EXT_PROF_PATH=${EXT_PROF_PATH:-""}
11+
KEYCHAIN_PATH=${KEYCHAIN_PATH:-""}
12+
13+
# Function to display usage
14+
usage() {
15+
echo"Usage:$0 [--app-prof-path <path>] [--ext-prof-path <path>] [--keychain-path <path>]"
16+
echo" --app-prof-path <path> Set the APP_PROF_PATH variable"
17+
echo" --ext-prof-path <path> Set the EXT_PROF_PATH variable"
18+
echo" --keychain-path <path> Set the KEYCHAIN_PATH variable"
19+
echo" -h, --help Display this help message"
720
}
821

9-
# Build Documentation @ https://developer.apple.com/forums/thread/737894
22+
# Parse command line arguments
23+
while [["$#"-gt 0 ]];do
24+
case$1in
25+
--app-prof-path)
26+
APP_PROF_PATH="$2"
27+
shift 2
28+
;;
29+
--ext-prof-path)
30+
EXT_PROF_PATH="$2"
31+
shift 2
32+
;;
33+
--keychain-path)
34+
KEYCHAIN_PATH="$2"
35+
shift 2
36+
;;
37+
-h | --help)
38+
usage
39+
exit 0
40+
;;
41+
*)
42+
echo"Unknown parameter passed:$1"
43+
usage
44+
exit 1
45+
;;
46+
esac
47+
done
48+
49+
# Check if required variables are set
50+
if [[-z"$APP_PROF_PATH"||-z"$EXT_PROF_PATH"||-z"$KEYCHAIN_PATH" ]];then
51+
echo"Missing required values"
52+
echo
53+
usage
54+
exit 1
55+
fi
1056

1157
XCODE_PROVISIONING_PROFILES_DIR="$HOME/Library/Developer/Xcode/UserData/Provisioning Profiles"
1258
ALT_PROVISIONING_PROFILES_DIR="$HOME/Library/MobileDevice/Provisioning Profiles"
1359
mkdir -p"$XCODE_PROVISIONING_PROFILES_DIR"
1460
mkdir -p"$ALT_PROVISIONING_PROFILES_DIR"
15-
APPLE_TEAM_ID="4399GN35BJ"
16-
CODE_SIGN_IDENTITY="Developer ID Application: Coder Technologies Inc (${APPLE_TEAM_ID})"
61+
62+
get_uuid() {
63+
strings"$1"| grep -E -o'[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}'
64+
}
1765

1866
# Extract the ID of each provisioning profile
1967
APP_PROVISIONING_PROFILE_ID=$(get_uuid"$APP_PROF_PATH")
@@ -29,41 +77,43 @@ cp "$EXT_PROF_PATH" "${ALT_PROVISIONING_PROFILES_DIR}/${EXT_PROVISIONING_PROFILE
2977
export APP_PROVISIONING_PROFILE_ID
3078
export EXT_PROVISIONING_PROFILE_ID
3179
export PTP_SUFFIX
80+
3281
make
82+
3383
xcodebuild \
34-
-project"Coder Desktop/Coder Desktop.xcodeproj" \
35-
-scheme"Coder Desktop" \
36-
-configuration"Release" \
37-
-skipPackagePluginValidation \
38-
CODE_SIGN_STYLE=Manual \
39-
CODE_SIGN_IDENTITY="$CODE_SIGN_IDENTITY" \
40-
CODE_SIGN_INJECT_BASE_ENTITLEMENTS=NO \
41-
OTHER_CODE_SIGN_FLAGS='--timestamp'| LC_ALL="en_US.UTF-8" xcpretty
84+
-project"Coder Desktop/Coder Desktop.xcodeproj" \
85+
-scheme"Coder Desktop" \
86+
-configuration"Release" \
87+
-skipPackagePluginValidation \
88+
CODE_SIGN_STYLE=Manual \
89+
CODE_SIGN_IDENTITY="$CODE_SIGN_IDENTITY" \
90+
CODE_SIGN_INJECT_BASE_ENTITLEMENTS=NO \
91+
OTHER_CODE_SIGN_FLAGS='--timestamp'| LC_ALL="en_US.UTF-8" xcpretty
4292

4393
mkdir build
4494
built_app_path="./Coder Desktop.app"
4595
ditto"$(find"$HOME/Library/Developer/Xcode/DerivedData" -name"Coder Desktop.app")""$built_app_path"
4696

4797
create-dmg \
48-
--identity="$CODE_SIGN_IDENTITY" \
49-
"$built_app_path" \
50-
./
98+
--identity="$CODE_SIGN_IDENTITY" \
99+
"$built_app_path" \
100+
./
51101

52102
# Add dmg to build artifacts
53103
dmg_path="./build/Coder Desktop.dmg"
54104
mv ./Coder\Desktop*.dmg"$dmg_path"
55105

56106
# Notarize
57107
xcrun notarytool store-credentials"notarytool-credentials" \
58-
--apple-id"$APPLE_ID" \
59-
--team-id"$APPLE_TEAM_ID" \
60-
--password"$APPLE_ID_PASSWORD" \
61-
--keychain"$KEYCHAIN_PATH"
108+
--apple-id"$APPLE_ID" \
109+
--team-id"$APPLE_TEAM_ID" \
110+
--password"$APPLE_ID_PASSWORD" \
111+
--keychain"$KEYCHAIN_PATH"
62112

63113
xcrun notarytool submit"$dmg_path" \
64-
--keychain-profile"notarytool-credentials" \
65-
--keychain"$KEYCHAIN_PATH" \
66-
--wait
114+
--keychain-profile"notarytool-credentials" \
115+
--keychain"$KEYCHAIN_PATH" \
116+
--wait
67117

68118
# Staple the notarization to the app and dmg, so they work without internet
69119
xcrun stapler staple"$dmg_path"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp