-
Notifications
You must be signed in to change notification settings - Fork 0
273 lines (229 loc) · 11.1 KB
/
vpdlx-release.yml
File metadata and controls
273 lines (229 loc) · 11.1 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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
# =============================================================================
# GITHUB ACTIONS WORKFLOW FOR VPDLX RELEASES
# =============================================================================
# This workflow is triggered manually through the GitHub Actions interface.
# It creates a GitHub Release for the VPDLX PowerShell module, including:
# - A ZIP archive containing only the relevant module files
# - The VPDLX logo embedded in the release page
# - A structured release description with version info and download link
#
# Excluded from ZIP:
# .backup/ | .docs/ | .gitignore | PROMPT.TXT | TODO.TXT
name: VPDLX Release
# GLOBAL VARS
env:
repo_folder: "VPDLX" # Source folder inside the repository
temp_folder: "VPDLX-Module" # Temporary staging folder name
workflow_file: "vpdlx-release.yml" # This workflow's filename
logo_url: "https://raw.githubusercontent.com/praetoriani/PowerShell.Mods/main/VPDLX/VPDLX.Logo.v1.png"
# TRIGGER CONFIGURATION
# Only manual dispatch — no automatic tag trigger
on:
workflow_dispatch:
inputs:
tag_name:
description: 'Tag name for the release (e.g., vpdlx-v1.02.06)'
required: true
default: 'vpdlx-v1.02.06'
type: string
create_tag:
description: 'Create the tag if it does not exist'
required: true
default: true
type: boolean
is_prerelease:
description: 'Mark this release as a pre-release'
required: true
default: false
type: boolean
release_notes:
description: 'Additional release notes (optional, Markdown supported)'
required: false
default: ''
type: string
# PERMISSIONS
permissions:
contents: write
actions: write
# JOB DEFINITION
jobs:
release:
runs-on: ubuntu-latest
steps:
# -----------------------------------------------------------------------
# STEP 1: Checkout repository
# -----------------------------------------------------------------------
- name: Checkout repository
uses: actions/checkout@v4
# -----------------------------------------------------------------------
# STEP 2: Validate inputs and set up release variables
# (zip_filename is derived dynamically from the version label)
# -----------------------------------------------------------------------
- name: Setup release variables
id: setup
run: |
TAG_NAME="${{ github.event.inputs.tag_name }}"
echo "🔧 Manual trigger detected"
echo "📝 Using tag: $TAG_NAME"
# Validate tag format (must start with "vpdlx-")
if [[ ! "$TAG_NAME" =~ ^vpdlx-.*$ ]]; then
echo "❌ Error: Tag name must start with 'vpdlx-'"
echo "❌ Provided value: $TAG_NAME"
exit 1
fi
# Derive a human-readable version label (strip the "vpdlx-" prefix)
VERSION_LABEL="${TAG_NAME#vpdlx-}"
# Build dynamic ZIP filename: VPDLX-<version_label>.zip
ZIP_FILENAME="VPDLX-${VERSION_LABEL}.zip"
# Export for later steps
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
echo "version_label=$VERSION_LABEL" >> $GITHUB_OUTPUT
echo "zip_filename=$ZIP_FILENAME" >> $GITHUB_OUTPUT
echo "✅ Tag validation successful"
echo "🏷️ Tag : $TAG_NAME"
echo "🔖 Version : $VERSION_LABEL"
echo "📦 ZIP name : $ZIP_FILENAME"
# -----------------------------------------------------------------------
# STEP 3: Create tag if it does not exist yet
# -----------------------------------------------------------------------
- name: Create tag if requested
if: github.event.inputs.create_tag == 'true'
run: |
TAG_NAME="${{ steps.setup.outputs.tag_name }}"
git config user.name "GitHub Actions Bot"
git config user.email "actions@github.com"
if git rev-parse "$TAG_NAME" >/dev/null 2>&1; then
echo "⚠️ Tag '$TAG_NAME' already exists — skipping creation"
else
echo "🏷️ Creating new tag: $TAG_NAME"
git tag "$TAG_NAME"
git push origin "$TAG_NAME"
echo "✅ Tag created and pushed"
fi
# -----------------------------------------------------------------------
# STEP 4: Build the release ZIP (with exclusions)
# -----------------------------------------------------------------------
- name: Build VPDLX release package
run: |
ZIP_FILENAME="${{ steps.setup.outputs.zip_filename }}"
echo "🚀 Building release package for ${{ env.repo_folder }}"
echo "📦 Target archive : $ZIP_FILENAME"
# Verify source folder exists
if [ ! -d "${{ env.repo_folder }}" ]; then
echo "❌ Source folder '${{ env.repo_folder }}' not found!"
echo "📂 Repository root contents:"
ls -la
exit 1
fi
# Create clean staging area
mkdir -p release-temp/${{ env.temp_folder }}
echo "📁 Staging folder created: release-temp/${{ env.temp_folder }}"
# Copy module files — then remove excluded items
cp -r "${{ env.repo_folder }}"/* release-temp/${{ env.temp_folder }}/
echo "🗑️ Removing excluded items..."
# Excluded directories
rm -rf "release-temp/${{ env.temp_folder }}/.backup"
rm -rf "release-temp/${{ env.temp_folder }}/.docs"
# Excluded files (case-insensitive)
find "release-temp/${{ env.temp_folder }}" -maxdepth 1 \
\( -iname ".gitignore" \
-o -iname "PROMPT.TXT" \
-o -iname "TODO.TXT" \) \
-delete
echo "✅ Exclusions applied"
# Show what will be packaged
echo ""
echo "📋 Staging folder contents (to be zipped):"
find release-temp/${{ env.temp_folder }} | sort
# Create ZIP archive with dynamic filename
cd release-temp
zip -r "../$ZIP_FILENAME" "${{ env.temp_folder }}/"
cd ..
echo ""
echo "✅ ZIP created:"
ls -lh "$ZIP_FILENAME"
echo ""
echo "📦 ZIP contents:"
unzip -l "$ZIP_FILENAME"
# -----------------------------------------------------------------------
# STEP 5: Create the GitHub Release
# -----------------------------------------------------------------------
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.setup.outputs.tag_name }}
name: "VPDLX ${{ steps.setup.outputs.version_label }}"
body: |
<p align="center">
<img src="${{ env.logo_url }}" alt="VPDLX Logo" width="340"/>
</p>
---
## 🗃️ VPDLX — Virtual PowerShell Data-Logger eXtension
**Version:** `${{ steps.setup.outputs.version_label }}`
**Tag:** `${{ steps.setup.outputs.tag_name }}`
A fully class-based virtual logging system for PowerShell.
Create, manage, and query multiple in-memory log files simultaneously
— without touching the filesystem — and export them to disk in up to
**6 formats** (`txt`, `log`, `csv`, `json`, `html`, `ndjson`) when needed.
---
## 📥 Download
**📦 [`${{ steps.setup.outputs.zip_filename }}`](https://github.com/${{ github.repository }}/releases/download/${{ steps.setup.outputs.tag_name }}/${{ steps.setup.outputs.zip_filename }})**
> The archive contains the complete `VPDLX` module folder, ready to be
> placed in any directory on your `$env:PSModulePath`.
---
## ⚙️ System Requirements
| Requirement | Minimum |
|---|---|
| PowerShell | 5.1 or higher (`Desktop` + `Core`) |
| OS | Windows 10 / 11 |
| Privileges | No administrator rights required |
---
## 🚀 Quick Install
```powershell
# 1. Extract the ZIP archive
# 2. Copy the VPDLX folder to your module path, e.g.:
Copy-Item -Path ".\VPDLX" -Destination "$HOME\Documents\PowerShell\Modules\VPDLX" -Recurse
# 3. Import and verify
Import-Module VPDLX
Get-Module VPDLX | Select-Object Name, Version
```
---
${{ github.event.inputs.release_notes != '' && format('## 📝 Additional Notes\n\n{0}\n\n---\n', github.event.inputs.release_notes) || '' }}
*This release was created manually via GitHub Actions by **${{ github.actor }}**.*
files: ${{ steps.setup.outputs.zip_filename }}
draft: false
prerelease: ${{ github.event.inputs.is_prerelease }}
fail_on_unmatched_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# -----------------------------------------------------------------------
# STEP 6: Summary log
# -----------------------------------------------------------------------
- name: Print release summary
run: |
TAG_NAME="${{ steps.setup.outputs.tag_name }}"
VERSION="${{ steps.setup.outputs.version_label }}"
ZIP_FILENAME="${{ steps.setup.outputs.zip_filename }}"
echo "========================================================"
echo " 🎉 VPDLX Release created successfully!"
echo "========================================================"
echo ""
echo " 📊 Release Information"
echo " ─────────────────────────────────────────────────────"
echo " 👤 Actor : ${{ github.actor }}"
echo " 🏷️ Tag : $TAG_NAME"
echo " 🔖 Version : $VERSION"
echo " 📦 Archive : $ZIP_FILENAME"
echo " ⚙️ Pre-Release: ${{ github.event.inputs.is_prerelease }}"
echo " ⏰ Timestamp : $(date '+%d.%m.%Y %H:%M:%S UTC')"
echo ""
echo " 🌐 Release Links"
echo " ─────────────────────────────────────────────────────"
echo " 📖 Release Page : https://github.com/${{ github.repository }}/releases/tag/$TAG_NAME"
echo " 💾 Direct DL : https://github.com/${{ github.repository }}/releases/download/$TAG_NAME/$ZIP_FILENAME"
echo ""
echo " 🔧 Workflow Management"
echo " ─────────────────────────────────────────────────────"
echo " ▶️ Run again : https://github.com/${{ github.repository }}/actions/workflows/${{ env.workflow_file }}"
echo "========================================================"