-
Notifications
You must be signed in to change notification settings - Fork 1
76 lines (67 loc) · 2.82 KB
/
Copy pathrelease.yml
File metadata and controls
76 lines (67 loc) · 2.82 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
name: Release
on:
push:
tags: ['v*']
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
release:
runs-on: macos-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
fetch-depth: 0
- name: Bump version in Info.plist
run: |
VERSION=${{ github.ref_name }}
VERSION_NUM=${VERSION#v}
plutil -replace CFBundleVersion -string "$VERSION_NUM" Notty.app/Contents/Info.plist
plutil -replace CFBundleShortVersionString -string "$VERSION_NUM" Notty.app/Contents/Info.plist
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git checkout main
git pull origin main
git add Notty.app/Contents/Info.plist
git diff --cached --quiet || git commit -m "[MODIFIED]: bump version to $VERSION"
git push origin main || true
- name: Update CHANGELOG
run: |
VERSION=${{ github.ref_name }}
DATE=$(date +%Y-%m-%d)
PREV_TAG=$(git tag --sort=-creatordate | grep -v "^${VERSION}$" | head -1)
COMMITS=$(git log ${PREV_TAG}..HEAD --pretty=format:"- %s" --no-merges | grep -v "bump version" | grep -v "CHANGELOG")
git pull origin main
# Prepend new entry using bash (avoids sed \n portability issues)
{ echo "# Changelog"; echo ""; echo "## [${VERSION}] — ${DATE}"; echo ""; echo "${COMMITS}"; echo ""; echo "---"; tail -n +2 CHANGELOG.md; } > /tmp/changelog_new.md
mv /tmp/changelog_new.md CHANGELOG.md
git add CHANGELOG.md
git diff --cached --quiet || git commit -m "[MODIFIED]: update CHANGELOG for $VERSION"
git push origin main
- name: Build Notty
run: make all
- name: Create .dmg
run: make dmg
env:
DYLD_LIBRARY_PATH: ""
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: Notty.dmg
generate_release_notes: true
- name: Update Homebrew formula
run: |
VERSION=${{ github.ref_name }}
URL="https://github.com/NovationLabs/Notty/archive/refs/tags/${VERSION}.tar.gz"
SHA=$(curl -sL "$URL" | shasum -a 256 | awk '{print $1}')
git clone https://x-access-token:${{ secrets.HOMEBREW_TAP_TOKEN }}@github.com/NovationLabs/homebrew-notty.git
cd homebrew-notty
sed -i '' "s|url \".*\"|url \"${URL}\"|" Formula/notty.rb
sed -i '' "s|sha256 \".*\"|sha256 \"${SHA}\"|" Formula/notty.rb
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git add Formula/notty.rb
git commit -m "[MODIFIED]: bump to ${VERSION}"
git push