-
Notifications
You must be signed in to change notification settings - Fork 2
115 lines (98 loc) · 3.17 KB
/
release.yml
File metadata and controls
115 lines (98 loc) · 3.17 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
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
name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: write
jobs:
build-macos:
strategy:
fail-fast: false
matrix:
include:
- args: '--target aarch64-apple-darwin'
arch: 'silicon'
- args: '--target x86_64-apple-darwin'
arch: 'intel'
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-apple-darwin,x86_64-apple-darwin
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: './src-tauri -> target'
- name: Install dependencies
run: npm install
- name: Build frontend
run: npm run build
- name: Generate release notes
id: release_notes
run: |
TAG_NAME="${{ github.ref_name }}"
PREV_TAG=$(git tag --sort=-v:refname | sed -n '2p')
if [ -z "$PREV_TAG" ]; then
COMMITS=$(git log --oneline --pretty=format:"- %s" --reverse)
else
COMMITS=$(git log "$PREV_TAG".."$TAG_NAME" --oneline --pretty=format:"- %s" --reverse)
fi
if [ -z "$COMMITS" ]; then
COMMITS="- No changes documented"
fi
echo "notes<<EOF" >> $GITHUB_OUTPUT
echo "$COMMITS" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Build and release
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: ${{ github.ref_name }}
releaseName: 'Snipp ${{ github.ref_name }}'
releaseBody: |
**Apple Silicon** (M1+): `Snipp_*_aarch64.dmg` | **Intel**: `Snipp_*_x64.dmg`
After installing, remove the quarantine flag:
```
xattr -d com.apple.quarantine /Applications/Snipp.app
```
### Changes
${{ steps.release_notes.outputs.notes }}
releaseDraft: true
prerelease: false
args: ${{ matrix.args }}
publish:
needs: build-macos
runs-on: ubuntu-latest
steps:
- name: Publish Release
uses: actions/github-script@v7
with:
script: |
const { data: releases } = await github.rest.repos.listReleases({
owner: context.repo.owner,
repo: context.repo.repo,
});
const tagName = context.ref.replace('refs/tags/', '');
const draftRelease = releases.find(r => r.draft && r.tag_name === tagName);
if (draftRelease) {
await github.rest.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: draftRelease.id,
draft: false,
});
console.log(`Published release: ${draftRelease.html_url}`);
} else {
console.log(`No draft release found for tag: ${tagName}`);
}