-
Notifications
You must be signed in to change notification settings - Fork 1
66 lines (59 loc) · 1.97 KB
/
Copy pathrelease.yml
File metadata and controls
66 lines (59 loc) · 1.97 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
name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
version:
description: "Semver version to release, without or with leading v"
required: true
permissions:
contents: write
jobs:
macos:
name: Build unsigned macOS release
runs-on: macos-15
steps:
- name: Check out repository
uses: actions/checkout@v6
- name: Resolve release version
id: version
shell: bash
run: |
set -euo pipefail
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
version="${{ inputs.version }}"
else
version="${GITHUB_REF_NAME}"
fi
version="${version#v}"
if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+([-+][0-9A-Za-z.-]+)?$ ]]; then
echo "Invalid semver version: $version" >&2
exit 2
fi
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "tag=v$version" >> "$GITHUB_OUTPUT"
- name: Package release assets
env:
BUILD_NUMBER: ${{ github.run_number }}
run: ./script/package_release.sh "${{ steps.version.outputs.version }}"
- name: Publish GitHub release
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ steps.version.outputs.tag }}
VERSION: ${{ steps.version.outputs.version }}
shell: bash
run: |
set -euo pipefail
notes="Unsigned macOS release. Standalone users may need to allow the app in macOS Gatekeeper settings."
if gh release view "$TAG" >/dev/null 2>&1; then
gh release edit "$TAG" --title "Catch $TAG" --notes "$notes"
gh release upload "$TAG" --clobber dist/release/*.dmg dist/release/*.tar.gz
else
gh release create "$TAG" \
--target "$GITHUB_SHA" \
--title "Catch $TAG" \
--notes "$notes" \
dist/release/*.dmg dist/release/*.tar.gz
fi