-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (75 loc) · 2.63 KB
/
release.yml
File metadata and controls
88 lines (75 loc) · 2.63 KB
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
on:
workflow_dispatch:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
release-dmg:
runs-on: macos-15
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Xcode version
run: xcodebuild -version
- name: Build (Release)
run: |
set -euo pipefail
xcodebuild -list
SCHEME="CopyShot"
xcodebuild \
-scheme "$SCHEME" \
-configuration Release \
-destination "generic/platform=macOS" \
-derivedDataPath build \
clean build
- name: Locate .app
id: locate_app
run: |
set -euo pipefail
APP_PATH="$(find build/Build/Products/Release -maxdepth 1 -name "*.app" -print -quit)"
if [ -z "${APP_PATH}" ]; then
echo "Could not find .app in build/Build/Products/Release"
ls -la build/Build/Products/Release || true
exit 1
fi
echo "APP_PATH=${APP_PATH}" >> $GITHUB_ENV
echo "app_path=${APP_PATH}" >> "$GITHUB_OUTPUT"
- name: Determine version string
id: version
run: |
set -euo pipefail
# If triggered by tag, use the tag name (v1.2.3). Otherwise use a timestamp.
if [ "${GITHUB_REF_TYPE}" = "tag" ]; then
VERSION="${GITHUB_REF_NAME}"
else
VERSION="manual-$(date +%Y%m%d-%H%M)"
fi
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "DMG_NAME=CopyShot-${VERSION}.dmg" >> $GITHUB_ENV
echo "dmg_name=CopyShot-${VERSION}.dmg" >> "$GITHUB_OUTPUT"
- name: Ad-hoc codesign (.app)
run: |
set -euo pipefail
codesign --force --deep --sign - "${{ steps.locate_app.outputs.app_path }}"
codesign --verify --deep --strict "${{ steps.locate_app.outputs.app_path }}"
- name: Create DMG
uses: ./.github/actions/create-dmg
with:
app_path: ${{ steps.locate_app.outputs.app_path }}
dmg_output_path: dist/${{ steps.version.outputs.dmg_name }}
- name: Create SHA256 checksum
run: |
set -euo pipefail
cd dist
shasum -a 256 "${DMG_NAME}" > "${DMG_NAME}.sha256"
ls -la
- name: Upload DMG + checksum to GitHub Release
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2.2.1
with:
files: |
dist/${{ steps.version.outputs.dmg_name }}
dist/${{ steps.version.outputs.dmg_name }}.sha256
generate_release_notes: true
draft: true