-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (99 loc) · 3.68 KB
/
release.yml
File metadata and controls
114 lines (99 loc) · 3.68 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
name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., v0.1.0)'
required: true
type: string
permissions:
contents: write
jobs:
build-macos:
name: Build macOS binaries
runs-on: macos-latest
strategy:
matrix:
arch: [arm64, x86_64]
steps:
- uses: actions/checkout@v4
- name: Build for ${{ matrix.arch }}
run: |
swift build -c release --arch ${{ matrix.arch }}
- name: Package binary
run: |
cd .build/${{ matrix.arch }}-apple-macosx/release
tar -czf whatprogress-macos-${{ matrix.arch }}.tar.gz WhatProgress
mv whatprogress-macos-${{ matrix.arch }}.tar.gz ${{ github.workspace }}/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: whatprogress-macos-${{ matrix.arch }}
path: whatprogress-macos-${{ matrix.arch }}.tar.gz
build-linux:
name: Build Linux binary
runs-on: ubuntu-latest
container:
image: swift:6.1
steps:
- uses: actions/checkout@v4
- name: Build for Linux
run: |
swift build -c release
- name: Package binary
run: |
tar -czf whatprogress-linux-x86_64.tar.gz -C .build/release WhatProgress
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: whatprogress-linux-x86_64
path: whatprogress-linux-x86_64.tar.gz
create-release:
name: Create GitHub Release
needs: [build-macos, build-linux]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Extract version from tag or manual input
if [ -n "${{ inputs.version }}" ]; then
VERSION="${{ inputs.version }}"
else
VERSION="${GITHUB_REF#refs/tags/}"
fi
# Create release notes
echo "# WhatProgress ${VERSION}" > release_notes.md
echo "" >> release_notes.md
echo "## Installation" >> release_notes.md
echo "" >> release_notes.md
echo "### macOS" >> release_notes.md
echo '```bash' >> release_notes.md
echo "# For Apple Silicon (M1/M2/M3):" >> release_notes.md
echo "curl -L https://github.com/${{ github.repository }}/releases/download/${VERSION}/whatprogress-macos-arm64.tar.gz | tar xz" >> release_notes.md
echo "sudo mv WhatProgress /usr/local/bin/whatprogress" >> release_notes.md
echo "" >> release_notes.md
echo "# For Intel:" >> release_notes.md
echo "curl -L https://github.com/${{ github.repository }}/releases/download/${VERSION}/whatprogress-macos-x86_64.tar.gz | tar xz" >> release_notes.md
echo "sudo mv WhatProgress /usr/local/bin/whatprogress" >> release_notes.md
echo '```' >> release_notes.md
echo "" >> release_notes.md
echo "### Linux" >> release_notes.md
echo '```bash' >> release_notes.md
echo "curl -L https://github.com/${{ github.repository }}/releases/download/${VERSION}/whatprogress-linux-x86_64.tar.gz | tar xz" >> release_notes.md
echo "sudo mv WhatProgress /usr/local/bin/whatprogress" >> release_notes.md
echo '```' >> release_notes.md
# Create release
gh release create "${VERSION}" \
--title "WhatProgress ${VERSION}" \
--notes-file release_notes.md \
artifacts/**/*.tar.gz