-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (102 loc) · 3.91 KB
/
build.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
name: build
on:
push:
branches:
- '**'
tags:
- "v*.*.*"
permissions:
actions: read
checks: read
contents: write
deployments: read
issues: read
discussions: read
packages: read
pull-requests: read
repository-projects: read
security-events: read
statuses: read
jobs:
build:
runs-on: macos-13
steps:
- uses: actions/checkout@v3
name: Checkout
- name: Install go
run: |
brew install go
GO_BINARY=$(which go)
echo "GO_BINARY=$GO_BINARY" >> .xcode.env.local
- name: Select Xcode
run: sudo xcode-select -s "/Applications/Xcode_15.1.app"
- name: Resolve dependencies
run: xcodebuild -resolvePackageDependencies
- name: Config environment
run: |
SCHEME=$(xcodebuild -list -json | jq -r '.project.schemes[0]')
BUILD_SETTINGS=$(xcodebuild -scheme "$SCHEME" -showBuildSettings -json | jq -r '.[0].buildSettings')
FULL_PRODUCT_NAME=$(echo $BUILD_SETTINGS | jq -r '.FULL_PRODUCT_NAME')
PRODUCT_NAME=$(echo $BUILD_SETTINGS | jq -r '.PRODUCT_NAME')
echo "SCHEME=$SCHEME" >> "$GITHUB_ENV"
echo "FULL_PRODUCT_NAME=$FULL_PRODUCT_NAME" >> "$GITHUB_ENV"
echo "PRODUCT_NAME=$PRODUCT_NAME" >> "$GITHUB_ENV"
- name: Install the Apple certificate
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
- name: Build
run: xcodebuild -scheme "$SCHEME" install DSTROOT=Build | xcpretty
- name: Package
run: |
npm install -g create-dmg
mkdir -p Build/dmg
create-dmg "Build/Applications/$FULL_PRODUCT_NAME" Build/dmg
mv Build/dmg/*.dmg Build/$PRODUCT_NAME.dmg
rm -r Build/dmg
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ env.PRODUCT_NAME }}.dmg
path: Build/${{ env.PRODUCT_NAME }}.dmg
- name: Prepare for release
if: startsWith(github.ref, 'refs/tags/')
run: |
set -e
VERSION=$(cat package.json | jq -r .version)
DMG_NAME="Build/${{ env.PRODUCT_NAME }}-v$VERSION.dmg"
CHANGELOG_PATH="$RUNNER_TEMP/CHANGELOG.md"
./scripts/changelog $VERSION > $CHANGELOG_PATH
cp Build/${{ env.PRODUCT_NAME }}.dmg $DMG_NAME
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
echo "DMG_NAME=$DMG_NAME" >> "$GITHUB_ENV"
echo "CHANGELOG_PATH=$CHANGELOG_PATH" >> "$GITHUB_ENV"
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
body_path: ${{ env.CHANGELOG_PATH }}
files: ${{ env.DMG_NAME }}
- name: Bump cask version
uses: benc-uk/workflow-dispatch@v1
if: startsWith(github.ref, 'refs/tags/')
with:
workflow: bump-cask.yaml
repo: softnetics/homebrew-tap
token: ${{ secrets.TAP_PAT }}
ref: main
inputs: '{ "cask": "dotlocal", "version": "${{ env.VERSION }}" }'