-
-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (110 loc) · 3.81 KB
/
Copy pathrelease.yml
File metadata and controls
130 lines (110 loc) · 3.81 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
name: Build and Release
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
artifact_name: folge-cli-linux-amd64
package_cmd: zip -r folge-cli-linux-amd64.zip folge-cli
- os: macos-latest
artifact_name: folge-cli-macos-arm64
package_cmd: tar czf folge-cli-macos-arm64.tar.gz folge-cli
- os: windows-latest
artifact_name: folge-cli-windows-amd64
package_cmd: 7z a folge-cli-windows-amd64.zip folge-cli.exe
runs-on: ${{ matrix.os }}
name: Build (${{ matrix.os }})
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Set up Python
run: uv python install 3.12
- name: Install Python dependencies
run: uv sync
- name: Install PyInstaller
# NOTE: the version spec must be quoted -- unquoted, ">=6.0" is parsed
# as shell redirection (both bash and pwsh treat a bare '>' as an
# output-redirect operator), which silently drops the version pin
# and writes a stray file named "=6.0" into the checkout.
run: uv pip install "pyinstaller>=6.0"
- name: Install system dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libcairo2-dev libpango1.0-dev libgdk-pixbuf2.0-dev libffi-dev
- name: Install system dependencies (macOS)
if: runner.os == 'macOS'
run: brew install cairo pango gdk-pixbuf libffi
- name: Build executable with PyInstaller
run: uv run pyinstaller pyinstaller/folge-cli.spec
- name: Verify executable
# Run the binary directly (no "uv run") -- this is the actual
# contract we're shipping: a standalone artifact that needs
# neither uv nor a Python install to run.
run: |
if [ "${{ runner.os }}" = "Windows" ]; then
BIN="dist/folge-cli.exe"
else
BIN="dist/folge-cli"
fi
"$BIN" --version
"$BIN" --help
shell: bash
- name: Package artifact (Linux/macOS)
if: runner.os != 'Windows'
run: |
cd dist
${{ matrix.package_cmd }}
shell: bash
- name: Package artifact (Windows)
if: runner.os == 'Windows'
run: |
cd dist
7z a folge-cli-windows-amd64.zip folge-cli.exe
shell: pwsh
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
# Only the packaged archive -- not the raw dist/folge-cli binary,
# which has the identical name on Linux and macOS and would
# collide when the release job merges all matrix artifacts
# into one directory.
path: dist/${{ matrix.artifact_name }}.*
if-no-files-found: error
retention-days: 5
release:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts/
merge-multiple: true
- name: List artifacts
run: find artifacts/ -type f | sort
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
artifacts/folge-cli-linux-amd64.zip
artifacts/folge-cli-macos-arm64.tar.gz
artifacts/folge-cli-windows-amd64.zip
generate_release_notes: true
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}