Repository navigation
103 lines (90 loc) · 3.57 KB
/
Copy pathrelease.yml
File metadata and controls
103 lines (90 loc) · 3.57 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
name: Release
# Publishes a GitHub Release for a version tag. Each release carries:
#
# OpenMouseDesktopSetup.exe the Windows installer. The file name never
# changes, so
# releases/latest/download/OpenMouseDesktopSetup.exe
# is a permanent "download the newest" link.
# latest.json what the app's update check reads
# (releases/latest/download/latest.json): version,
# notes, and the installer's URL and SHA-256.
#
# To release: bump `version` in gpui/Cargo.toml (and gpui/installer/Cargo.toml),
# add that version's entry to gpui/js/lib/changelog.ts, merge, then push a tag
# like v0.1.0 (or run this by hand with that tag). The tag, Cargo version and
# changelog entry must all agree or the run stops before publishing.
#
# `releases/latest` only resolves to the newest non-draft, non-prerelease
# release, so this publishes as one.
on:
workflow_dispatch:
inputs:
tag:
description: "Tag to release, e.g. v0.1.0 (created from the selected branch if it does not exist)"
required: true
push:
tags:
- "v*.*.*"
permissions:
contents: write
jobs:
release:
runs-on: windows-latest
env:
TAG: ${{ github.event.inputs.tag || github.ref_name }}
steps:
- uses: actions/checkout@v4
- name: Check the tag matches the app version
shell: bash
run: |
version="${TAG#v}"
cargo_version=$(sed -n 's/^version = "\(.*\)"/\1/p' gpui/Cargo.toml | head -1)
installer_version=$(sed -n 's/^version = "\(.*\)"/\1/p' gpui/installer/Cargo.toml | head -1)
if [ "$version" != "$cargo_version" ] || [ "$version" != "$installer_version" ]; then
echo "::error::Tag $TAG, gpui/Cargo.toml ($cargo_version) and gpui/installer/Cargo.toml ($installer_version) must all be the same version."
exit 1
fi
- uses: actions/setup-node@v4
with:
node-version: lts/*
cache: npm
- uses: dtolnay/rust-toolchain@stable
# Same cache the build workflow fills on main, installer included.
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
gpui
gpui/installer
shared-key: windows
- name: Install JS dependencies
run: npm ci
# A tag can point at any commit, so don't publish without the tests.
# Cheap now: the shared cache already holds the test build.
- name: Test
run: cargo test
working-directory: gpui
- name: Build release binary
run: cargo build --release
working-directory: gpui
# Embeds the app's release .exe as the installer's payload.
- name: Build installer
run: cargo build --release
working-directory: gpui/installer
- name: Collect release files
shell: bash
run: |
mkdir release
cp gpui/installer/target/release/openmouse-installer.exe release/OpenMouseDesktopSetup.exe
node .github/scripts/make-release-files.mjs "$TAG" release/OpenMouseDesktopSetup.exe "$GITHUB_REPOSITORY" release
cat release/latest.json
- name: Publish release
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "$TAG" \
release/OpenMouseDesktopSetup.exe release/latest.json \
--title "OpenMouse Desktop $TAG" \
--notes-file release/notes.md \
--target "$GITHUB_SHA" \
--latest