-
Notifications
You must be signed in to change notification settings - Fork 0
153 lines (129 loc) · 4.15 KB
/
release.yml
File metadata and controls
153 lines (129 loc) · 4.15 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: Release & Publish
on:
push:
tags:
- 'v*.*.*'
jobs:
create-release:
name: Create GitHub Release
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
release_id: ${{ steps.create_release.outputs.result }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generate changelog
id: changelog
run: |
# Get the previous tag
PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
# Generate changelog between tags
if [ -z "$PREVIOUS_TAG" ]; then
CHANGELOG=$(git log --pretty=format:"- %s (%h)" HEAD)
else
CHANGELOG=$(git log --pretty=format:"- %s (%h)" $PREVIOUS_TAG..HEAD)
fi
echo "CHANGELOG<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create Release
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG_NAME: ${{ github.ref_name }}
run: |
gh release create "$TAG_NAME" \
--repo="${GITHUB_REPOSITORY}" \
--title="Release ${TAG_NAME}" \
--notes="## What's Changed
${{ steps.changelog.outputs.CHANGELOG }}
## Installation
Download the appropriate installer for your platform below.
**Full Changelog**: https://github.com/${GITHUB_REPOSITORY}/commits/${TAG_NAME}"
build-and-release:
name: Build & Upload (${{ matrix.os }})
needs: create-release
runs-on: ${{ matrix.os }}
permissions:
contents: write
strategy:
matrix:
include:
# - os: ubuntu-latest
# platform: linux
- os: macos-latest
platform: mac
- os: windows-latest
platform: win
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 9
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build application
run: pnpm build
- name: Package application (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
pnpm --filter @polynote/desktop run package:linux
- name: Package application (macOS)
if: matrix.os == 'macos-latest'
run: |
pnpm --filter @polynote/desktop run package:mac
- name: Package application (Windows)
if: matrix.os == 'windows-latest'
run: |
pnpm --filter @polynote/desktop run package:win
- name: Upload Release Assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG_NAME: ${{ github.ref_name }}
shell: bash
run: |
cd apps/desktop/dist
# Upload all distributable files (not unpacked directories)
for file in *.{AppImage,deb,rpm,dmg,zip,exe,msi}; do
if [ -f "$file" ]; then
echo "Uploading $file..."
gh release upload "$TAG_NAME" "$file" --repo="${GITHUB_REPOSITORY}" --clobber
fi
done
# publish-npm:
# name: Publish to npm
# needs: create-release
# runs-on: ubuntu-latest
# if: startsWith(github.ref, 'refs/tags/v') && secrets.NPM_TOKEN != ''
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
# - name: Setup pnpm
# uses: pnpm/action-setup@v2
# with:
# version: 9
# - name: Setup Node.js
# uses: actions/setup-node@v4
# with:
# node-version: '22'
# cache: 'pnpm'
# registry-url: 'https://registry.npmjs.org'
# - name: Install dependencies
# run: pnpm install --frozen-lockfile
# - name: Build packages
# run: pnpm build
# - name: Publish to npm
# run: pnpm publish -r --access public --no-git-checks
# env:
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}