-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (71 loc) · 2.52 KB
/
release-framework.yml
File metadata and controls
80 lines (71 loc) · 2.52 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
name: Release Framework
on:
push:
tags:
- 'fw-*'
workflow_dispatch:
inputs:
tag:
description: 'Release tag (e.g., fw-4.2.0)'
required: true
permissions:
contents: write
jobs:
package-framework:
name: Package Framework
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.event.inputs.tag || github.ref_name }}
- name: Resolve tag and version
id: version
run: |
TAG="${{ github.event.inputs.tag || github.ref_name }}"
VERSION="${TAG#fw-}"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "Packaging Framework $VERSION from tag $TAG"
- name: Verify dist-manifest.yml version matches tag
run: |
MANIFEST_VERSION=$(grep '^version:' dist/dist-manifest.yml | sed 's/version: *"\(.*\)"/\1/')
TAG_VERSION="${{ steps.version.outputs.version }}"
if [ "$MANIFEST_VERSION" != "$TAG_VERSION" ]; then
echo "ERROR: dist-manifest.yml version ($MANIFEST_VERSION) does not match tag version ($TAG_VERSION)"
exit 1
fi
- name: Create distribution ZIP
run: |
mkdir -p dist-staging
cp -a dist/. dist-staging/
cd dist-staging
zip -r "../devtrail-fw-${{ steps.version.outputs.version }}.zip" .
cd ..
- name: Create or update GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="${{ steps.version.outputs.tag }}"
VERSION="${{ steps.version.outputs.version }}"
ASSET="devtrail-fw-${VERSION}.zip"
if gh release view "$TAG" > /dev/null 2>&1; then
echo "Release $TAG exists, uploading asset..."
gh release upload "$TAG" "$ASSET" --clobber
else
echo "Creating release $TAG..."
gh release create "$TAG" \
--title "DevTrail Framework $VERSION" \
--generate-notes \
"$ASSET"
fi
- name: Delete previous framework releases
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
CURRENT_TAG="${{ steps.version.outputs.tag }}"
gh release list --json tagName --jq '.[].tagName' | while read -r tag; do
if [[ "$tag" == fw-* && "$tag" != "$CURRENT_TAG" ]]; then
echo "Deleting old release $tag..."
gh release delete "$tag" --yes --cleanup-tag
fi
done