Repository navigation
131 lines (118 loc) · 3.63 KB
/
Copy pathrelease.yml
File metadata and controls
131 lines (118 loc) · 3.63 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
name: Release
on:
push:
tags: ['v*']
workflow_dispatch:
inputs:
tag:
description: 'Release tag to publish (e.g. v0.1.0)'
required: true
default: 'v0.1.0'
permissions:
contents: write
jobs:
build:
name: SEA binary (${{ matrix.platform }})
runs-on: ${{ matrix.os }}
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
platform: linux-x64
asset: gitdeck-linux-x64
built: gitdeck
- os: ubuntu-24.04-arm
platform: linux-arm64
asset: gitdeck-linux-arm64
built: gitdeck
- os: windows-latest
platform: windows-x64
asset: gitdeck-windows-x64.exe
built: gitdeck.exe
- os: macos-latest
platform: macos-arm64
asset: gitdeck-macos-arm64
built: gitdeck
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 12.15.0
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build single-file executable (Node SEA)
run: pnpm build:sea
- name: Prepare release asset
shell: bash
run: |
set -euo pipefail
mkdir -p out
cp "build/sea/${{ matrix.built }}" "out/${{ matrix.asset }}"
chmod +x "out/${{ matrix.asset }}" || true
file "out/${{ matrix.asset }}" || true
ls -lh out
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: gitdeck-${{ matrix.platform }}
path: out/*
if-no-files-found: error
retention-days: 7
release:
name: Publish GitHub Release
needs: build
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: write
steps:
- name: Download binaries
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Show assets
shell: bash
run: ls -lh dist
- name: Generate SHA256SUMS
shell: bash
run: |
set -euo pipefail
cd dist
sha256sum gitdeck-* > SHA256SUMS.txt
cat SHA256SUMS.txt
- name: Publish release
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}
run: |
set -euo pipefail
echo "publishing $TAG"
if gh release view "$TAG" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
gh release upload "$TAG" dist/* --repo "$GITHUB_REPOSITORY" --clobber
gh release edit "$TAG" --repo "$GITHUB_REPOSITORY" --title "GitDeck $TAG" --notes-from-tag >/dev/null 2>&1 || true
elif gh api "repos/$GITHUB_REPOSITORY/git/ref/tags/$TAG" >/dev/null 2>&1; then
gh release create "$TAG" dist/* \
--repo "$GITHUB_REPOSITORY" \
--title "GitDeck $TAG" \
--generate-notes
else
gh release create "$TAG" dist/* \
--repo "$GITHUB_REPOSITORY" \
--title "GitDeck $TAG" \
--generate-notes \
--target main
fi
gh release view "$TAG" --repo "$GITHUB_REPOSITORY" --json url,assets \
--jq '{url: .url, assets: [.assets[].name]}'