-
Notifications
You must be signed in to change notification settings - Fork 0
179 lines (154 loc) · 6.44 KB
/
Copy pathrelease.yml
File metadata and controls
179 lines (154 loc) · 6.44 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Release version (e.g., v1.0.0)'
required: true
type: string
release:
types: [published]
push:
tags:
- 'v*'
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: '10.15.0'
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Run quality checks
run: pnpm quality-gate
- name: Build all packages
run: pnpm build
- name: Determine version
id: version
run: |
if [ -n "${{ github.event.inputs.version }}" ]; then
VERSION="${{ github.event.inputs.version }}"
elif [ -n "${{ github.event.release.tag_name }}" ]; then
VERSION="${{ github.event.release.tag_name }}"
elif [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION="${GITHUB_REF#refs/tags/}"
else
echo "Error: Could not determine version"
exit 1
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Create manual release artifacts
run: |
chmod +x scripts/package-manual.sh
./scripts/package-manual.sh ${{ steps.version.outputs.version }}
- name: Upload release artifacts as workflow artifacts
uses: actions/upload-artifact@v4
with:
name: pair-cli-manual-${{ steps.version.outputs.version }}
path: |
release/pair-cli-manual-${{ steps.version.outputs.version }}.zip
release/pair-cli-manual-${{ steps.version.outputs.version }}.zip.sha256
retention-days: 30
- name: Smoke-test packaged artifact (verify checksum and run --version)
run: |
set -euo pipefail
V=${{ steps.version.outputs.version }}
ZIP=release/pair-cli-manual-${V}.zip
SUM=release/pair-cli-manual-${V}.zip.sha256
if [ ! -f "$ZIP" ]; then
echo "Error: artifact $ZIP not found"
exit 1
fi
if [ ! -f "$SUM" ]; then
echo "Error: checksum $SUM not found"
exit 1
fi
# Verify checksum (use sha256sum if present, else shasum)
if command -v sha256sum >/dev/null 2>&1; then
calc=$(sha256sum "$ZIP" | awk '{print $1}')
else
calc=$(shasum -a 256 "$ZIP" | awk '{print $1}')
fi
expected=$(cat "$SUM" | tr -d '\n' | tr -d '\r')
if [ "$calc" != "$expected" ]; then
echo "Error: checksum mismatch (expected $expected, got $calc)"
exit 1
fi
TMPDIR=$(mktemp -d)
unzip -q "$ZIP" -d "$TMPDIR"
ART_DIR="$TMPDIR/pair-cli-manual-${V}"
if [ ! -d "$ART_DIR" ]; then
echo "Error: extracted artifact directory not found: $ART_DIR"
ls -la "$TMPDIR"
exit 1
fi
# Try running top-level wrapper first, else call node directly
if [ -x "$ART_DIR/pair-cli" ]; then
"$ART_DIR/pair-cli" --version || true
elif [ -x "$ART_DIR/bin/pair-cli" ]; then
"$ART_DIR/bin/pair-cli" --version || true
elif [ -f "$ART_DIR/bundle-cli/index.js" ]; then
node "$ART_DIR/bundle-cli/index.js" --version || true
else
echo "Warning: no runnable binary found in artifact to smoke-test"
fi
echo "Smoke-test completed (exit codes may be non-zero for CLI version checks if the bundle returns non-zero); proceed with release if tests are acceptable."
- name: Create GitHub Release
id: create_release
if: github.event_name != 'workflow_dispatch' || github.event.inputs.version != ''
uses: actions/create-release@v1
with:
tag_name: ${{ steps.version.outputs.version }}
release_name: Release ${{ steps.version.outputs.version }}
body: |
## Manual Installation Artifacts
This release includes bundled artifacts for manual installation in air-gapped or restricted environments.
### Downloads
- **ZIP Archive**: `pair-cli-manual-${{ steps.version.outputs.version }}.zip`
- **SHA256 Checksum**: `pair-cli-manual-${{ steps.version.outputs.version }}.zip.sha256`
### Installation Instructions
1. Download the ZIP archive
2. Verify the checksum: `sha256sum pair-cli-manual-${{ steps.version.outputs.version }}.zip`
3. Extract the archive
4. Run the executable: `./pair-cli --help`
### What's Included
- Self-contained Node.js bundle (no external dependencies required)
- Cross-platform executables (Linux/macOS/Windows)
- TypeScript definitions
- Configuration files
- Documentation and license
For more details, see [RELEASE.md](docs/RELEASE.md) and [CLI README](apps/pair-cli/README.md).
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload release assets to the created release
if: github.event_name != 'workflow_dispatch' || github.event.inputs.version != ''
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url || env.RELEASE_UPLOAD_URL }}
asset_path: release/pair-cli-manual-${{ steps.version.outputs.version }}.zip
asset_name: pair-cli-manual-${{ steps.version.outputs.version }}.zip
asset_content_type: application/zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload checksum to the release
if: github.event_name != 'workflow_dispatch' || github.event.inputs.version != ''
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url || env.RELEASE_UPLOAD_URL }}
asset_path: release/pair-cli-manual-${{ steps.version.outputs.version }}.zip.sha256
asset_name: pair-cli-manual-${{ steps.version.outputs.version }}.zip.sha256
asset_content_type: text/plain
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}