Skip to content

Commit 47d0464

Browse files
ci: build for distribution (#37)
Signed-off-by: Thomas Kosiewski <[email protected]> Co-authored-by: Thomas Kosiewski <[email protected]>
1 parent 64b8d52 commit 47d0464

File tree

18 files changed

+9955
-81
lines changed

18 files changed

+9955
-81
lines changed

.env

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Build a release locally using: op run --env-file="./.env" -- make release
2+
APPLE_CERT="op://Apple/Apple DeveloperID PKCS12 base64/notesPlain"
3+
CERT_PASSWORD="op://Apple/DeveloperID p12 password/password"
4+
5+
APPLE_ID="op://Apple/3apcadvvcojjbpxnd7m5fgh5wm/username"
6+
APPLE_ID_PASSWORD="op://Apple/3apcadvvcojjbpxnd7m5fgh5wm/password"
7+
8+
APP_PROF="op://Apple/Provisioning Profiles/profiles/application_base64"
9+
EXT_PROF="op://Apple/Provisioning Profiles/profiles/extension_base64"

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nix/create-dmg/package-lock.json -diff

.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: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,13 @@ jobs:
1818
name: test
1919
runs-on: ${{ github.repository_owner == 'coder' && 'depot-macos-latest' || 'macos-latest'}}
2020
steps:
21-
- name: Harden Runner
22-
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
23-
with:
24-
egress-policy: audit
25-
2621
- name: Checkout
2722
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2823
with:
2924
fetch-depth: 1
25+
persist-credentials: false
26+
27+
- run: git fetch --tags
3028

3129
- name: Switch XCode Version
3230
uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0
@@ -44,15 +42,13 @@ jobs:
4442
name: fmt
4543
runs-on: ${{ github.repository_owner == 'coder' && 'depot-macos-latest' || 'macos-latest'}}
4644
steps:
47-
- name: Harden Runner
48-
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
49-
with:
50-
egress-policy: audit
51-
5245
- name: Checkout
5346
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
5447
with:
5548
fetch-depth: 1
49+
persist-credentials: false
50+
51+
- run: git fetch --tags
5652

5753
- name: Switch XCode Version
5854
uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0
@@ -70,15 +66,13 @@ jobs:
7066
name: lint
7167
runs-on: ${{ github.repository_owner == 'coder' && 'depot-macos-latest' || 'macos-latest'}}
7268
steps:
73-
- name: Harden Runner
74-
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
75-
with:
76-
egress-policy: audit
77-
7869
- name: Checkout
7970
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
8071
with:
8172
fetch-depth: 1
73+
persist-credentials: false
74+
75+
- run: git fetch --tags
8276

8377
- name: Setup Nix
8478
uses: ./.github/actions/nix-devshell

.github/workflows/release.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions: {}
8+
9+
jobs:
10+
build:
11+
runs-on: ${{ github.repository_owner == 'coder' && 'depot-macos-latest' || 'macos-latest'}}
12+
if: ${{ github.repository_owner == 'coder' }}
13+
permissions:
14+
# To upload assets to the release
15+
contents: write
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
19+
with:
20+
fetch-depth: 1
21+
persist-credentials: false
22+
23+
- run: git fetch --tags
24+
25+
- name: Switch XCode Version
26+
uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0
27+
with:
28+
xcode-version: "16.0.0"
29+
30+
- name: Setup Nix
31+
uses: ./.github/actions/nix-devshell
32+
33+
- name: Build
34+
env:
35+
APPLE_CERT: ${{ secrets.APPLE_DEVELOPER_ID_PKCS12_B64 }}
36+
APPLE_ID: ${{ secrets.APPLE_NOTARYTOOL_USERNAME }}
37+
APPLE_ID_PASSWORD: ${{ secrets.APPLE_NOTARYTOOL_PASSWORD }}
38+
APP_PROF: ${{ secrets.CODER_DESKTOP_APP_PROVISIONPROFILE_B64 }}
39+
CERT_PASSWORD: ${{ secrets.APPLE_DEVELOPER_ID_PKCS12_PASSWORD }}
40+
EXT_PROF: ${{ secrets.CODER_DESKTOP_EXTENSION_PROVISIONPROFILE_B64 }}
41+
run: make release
42+
43+
- name: Upload Release Assets
44+
run: gh release upload "$RELEASE_TAG" "$out"
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
RELEASE_TAG: ${{ github.event.release.tag_name }}

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,3 +295,10 @@ xcuserdata
295295
buildServer.json
296296

297297
# End of https://www.toptal.com/developers/gitignore/api/xcode,jetbrains,macos,direnv,swift,swiftpm,objective-c
298+
299+
*.entitlements
300+
app-signing.keychain-db
301+
release/
302+
303+
# marker files
304+
.fl5C1A396C

Coder Desktop/Coder Desktop/Coder_Desktop.entitlements

Lines changed: 0 additions & 16 deletions
This file was deleted.

Coder Desktop/Coder Desktop/Views/LoginForm.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,9 @@ enum LoginField: Hashable {
194194
case sessionToken
195195
}
196196

197-
#Preview {
198-
LoginForm<PreviewSession>()
199-
.environmentObject(PreviewSession())
200-
}
197+
#if DEBUG
198+
#Preview {
199+
LoginForm<PreviewSession>()
200+
.environmentObject(PreviewSession())
201+
}
202+
#endif

Coder Desktop/Coder Desktop/Views/Settings/NetworkTab.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ struct NetworkTab<VPN: VPNService>: View {
99
}
1010
}
1111

12-
#Preview {
13-
NetworkTab<PreviewVPN>()
14-
}
12+
#if DEBUG
13+
#Preview {
14+
NetworkTab<PreviewVPN>()
15+
}
16+
#endif

0 commit comments

Comments
 (0)