-
Notifications
You must be signed in to change notification settings - Fork 16
236 lines (201 loc) Β· 8.8 KB
/
beta-release.yml
File metadata and controls
236 lines (201 loc) Β· 8.8 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
name: Beta Release
on:
push:
branches:
- develop
paths-ignore:
- '.github/workflows/**'
- '**.md'
- 'docs/**'
workflow_dispatch:
inputs:
force_publish:
description: 'Force beta publish (ignore checks)'
required: false
default: false
type: boolean
jobs:
# Build and create beta release
build-beta:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.package.outputs.version }}
beta_version: ${{ steps.package.outputs.beta_version }}
vsix_name: ${{ steps.build.outputs.vsix_name }}
should_publish: ${{ steps.verify.outputs.should_publish }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Verify develop commits included
run: |
# Get current branch name
CURRENT_BRANCH="${GITHUB_REF#refs/heads/}"
echo "π Current branch: $CURRENT_BRANCH"
# Skip check if we're on develop branch itself
if [ "$CURRENT_BRANCH" = "develop" ]; then
echo "β
Running on develop branch - skipping verification"
exit 0
fi
# Fetch develop branch
git fetch origin develop 2>/dev/null || true
if ! git rev-parse --verify origin/develop >/dev/null 2>&1; then
echo "β οΈ Develop branch not found - skipping verification"
exit 0
fi
# Check if develop is an ancestor of current branch (all develop commits are included)
if git merge-base --is-ancestor origin/develop HEAD; then
echo "β
All commits from develop are included in $CURRENT_BRANCH"
else
echo "β ERROR: Current branch is missing commits from develop!"
echo ""
echo "Please merge or rebase develop into your feature branch:"
echo " git checkout $CURRENT_BRANCH"
echo " git merge origin/develop"
echo " # or"
echo " git rebase origin/develop"
exit 1
fi
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm ci
- name: Compile TypeScript
run: npm run compile
- name: Lint code
run: npm run lint
- name: Verify changes
id: verify
run: |
# For manual triggers with force flag
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ "${{ github.event.inputs.force_publish }}" = "true" ]; then
echo "π Manual workflow dispatch with force publish - proceeding with beta release"
echo "should_publish=true" >> $GITHUB_OUTPUT
exit 0
fi
# Get changed files
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD | tr '\n' ' ')
elif [ -z "${{ github.event.before }}" ] || [ "${{ github.event.before }}" = "0000000000000000000000000000000000000000" ]; then
CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD 2>/dev/null || git ls-files | tr '\n' ' ')
else
CHANGED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | tr '\n' ' ')
fi
echo "π Changed files: $CHANGED_FILES"
# Check if only documentation or workflow files were changed
SKIP_PUBLISH=true
for file in $CHANGED_FILES; do
if [[ ! $file =~ \.(md|txt)$ ]] && [[ ! $file =~ ^docs/ ]] && [[ ! $file =~ ^\.github/workflows/ ]]; then
SKIP_PUBLISH=false
break
fi
done
if [[ "$SKIP_PUBLISH" == "true" ]]; then
echo "π Only documentation or workflow files changed - skipping beta release"
echo "should_publish=false" >> $GITHUB_OUTPUT
else
echo "β
Code changes detected - proceeding with beta release"
echo "should_publish=true" >> $GITHUB_OUTPUT
fi
- name: Get package info and create beta version
id: package
run: |
VERSION=$(node -p "require('./package.json').version")
TIMESTAMP=$(date +'%Y%m%d%H%M%S')
BETA_VERSION="${VERSION}-beta.${TIMESTAMP}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "beta_version=$BETA_VERSION" >> $GITHUB_OUTPUT
echo "timestamp=$TIMESTAMP" >> $GITHUB_OUTPUT
echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
echo "π¦ Base version: $VERSION"
echo "π¬ Beta version: $BETA_VERSION"
- name: Update package.json with beta version
if: steps.verify.outputs.should_publish == 'true'
run: |
node -e "
const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
pkg.version = '${{ steps.package.outputs.beta_version }}';
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');
"
echo "β
Updated package.json to beta version"
- name: Build VSIX package
id: build
if: steps.verify.outputs.should_publish == 'true'
run: |
npm install -g @vscode/vsce@latest
rm -f *.vsix
vsce package --pre-release
VSIX_NAME="simple-coding-time-tracker-${{ steps.package.outputs.beta_version }}.vsix"
echo "vsix_name=$VSIX_NAME" >> $GITHUB_OUTPUT
# Validate VSIX
if [ ! -f "$VSIX_NAME" ]; then
echo "β VSIX build failed"
exit 1
fi
# Get file size
SIZE=$(stat -c%s "$VSIX_NAME" 2>/dev/null || stat -f%z "$VSIX_NAME")
SIZE_MB=$((SIZE / 1024 / 1024))
echo "π¦ Package size: ${SIZE_MB}MB"
echo "β
Beta VSIX built successfully - $VSIX_NAME"
- name: Upload VSIX artifact
if: steps.verify.outputs.should_publish == 'true'
uses: actions/upload-artifact@v4
with:
name: extension-vsix-beta-${{ steps.package.outputs.beta_version }}
path: ${{ steps.build.outputs.vsix_name }}
retention-days: 30
# Create GitHub Release for beta
create-beta-release:
needs: build-beta
if: needs.build-beta.outputs.should_publish == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download VSIX artifact
uses: actions/download-artifact@v4
with:
name: extension-vsix-beta-${{ needs.build-beta.outputs.beta_version }}
- name: Create GitHub Beta Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ needs.build-beta.outputs.beta_version }}
name: Beta Release v${{ needs.build-beta.outputs.beta_version }}
body: |
π¬ **Beta Release**
This is a pre-release build from the `develop` branch for testing purposes.
**Base Version:** ${{ needs.build-beta.outputs.version }}
**Beta Version:** ${{ needs.build-beta.outputs.beta_version }}
**Branch:** develop
**Commit:** ${{ github.sha }}
### Installation
Download the `.vsix` file and install manually:
1. Download `${{ needs.build-beta.outputs.vsix_name }}`
2. Open VS Code
3. Go to Extensions view (Ctrl+Shift+X)
4. Click on "..." menu β Install from VSIX...
5. Select the downloaded file
### β οΈ Warning
This is a beta release and may contain bugs or incomplete features. Use at your own risk.
### Feedback
Please report any issues or feedback on the [GitHub Issues](https://github.com/${{ github.repository }}/issues) page.
files: ${{ needs.build-beta.outputs.vsix_name }}
draft: false
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Summary
run: |
echo "### π Beta Release Created Successfully!" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Version:** ${{ needs.build-beta.outputs.beta_version }}" >> $GITHUB_STEP_SUMMARY
echo "**Tag:** v${{ needs.build-beta.outputs.beta_version }}" >> $GITHUB_STEP_SUMMARY
echo "**VSIX:** ${{ needs.build-beta.outputs.vsix_name }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "π [View Release](https://github.com/${{ github.repository }}/releases/tag/v${{ needs.build-beta.outputs.beta_version }})" >> $GITHUB_STEP_SUMMARY