-
Notifications
You must be signed in to change notification settings - Fork 18
184 lines (158 loc) · 6.05 KB
/
Copy pathrelease.yml
File metadata and controls
184 lines (158 loc) · 6.05 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
name: Create Release
on:
workflow_dispatch:
inputs:
tag:
description: 'Git tag to release (e.g., v1.2.3)'
required: true
type: string
jobs:
verify-and-release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
fetch-tags: true
persist-credentials: false
- name: Validate tag format
run: |
TAG="${GITHUB_EVENT_INPUTS_TAG}"
if [[ ! $TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "❌ Invalid tag format. Expected format: v1.2.3"
exit 1
fi
echo "✅ Tag format is valid: $TAG"
env:
GITHUB_EVENT_INPUTS_TAG: ${{ github.event.inputs.tag }}
- name: Verify tag exists
run: |
TAG="${GITHUB_EVENT_INPUTS_TAG}"
if ! git rev-parse --verify "refs/tags/$TAG" >/dev/null 2>&1; then
echo "❌ Tag '$TAG' does not exist in the repository"
echo "Available tags:"
git tag --sort=-version:refname | head -10
exit 1
fi
echo "✅ Tag '$TAG' exists"
env:
GITHUB_EVENT_INPUTS_TAG: ${{ github.event.inputs.tag }}
- name: Checkout specific tag
run: |
git checkout ${GITHUB_EVENT_INPUTS_TAG}
env:
GITHUB_EVENT_INPUTS_TAG: ${{ github.event.inputs.tag }}
- name: Verify GPG signature on tag
run: |
TAG="${GITHUB_EVENT_INPUTS_TAG}"
# Force fetch the complete tag object (not just commit reference)
echo "=== Fetching Tag Object ==="
git fetch origin tag $TAG --force
# Debug: Show what type of object we have
echo "=== Tag Object Debug ==="
git cat-file -t $TAG
echo "Tag points to commit: $(git rev-parse $TAG^{})"
echo "Tag object hash: $(git rev-parse $TAG)"
echo "=== End Tag Debug ==="
# Import public key for verification
echo "=== Importing GPG Key ==="
echo '${{ secrets.GPG_PUBLIC_KEY }}' > /tmp/pubkey.asc
head -3 /tmp/pubkey.asc
gpg --import /tmp/pubkey.asc
echo "=== GPG Key Imported ==="
# Verify the tag is properly signed
echo "=== Verifying Tag Signature ==="
git tag -v $TAG
echo "✅ Tag signature verified"
# Cleanup
rm /tmp/pubkey.asc
env:
GITHUB_EVENT_INPUTS_TAG: ${{ github.event.inputs.tag }}
- name: Get version from tag
id: get_version
run: |
TAG="${GITHUB_EVENT_INPUTS_TAG}"
VERSION=${TAG#v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "tag=$TAG" >> $GITHUB_OUTPUT
env:
GITHUB_EVENT_INPUTS_TAG: ${{ github.event.inputs.tag }}
- name: Package repository
run: |
mkdir -p dist
# Create source package
zip -r dist/fractum-${STEPS_GET_VERSION_OUTPUTS_VERSION}-source.zip \
src/ \
packages/ \
tests/ \
bootstrap-*.sh \
bootstrap-*.ps1 \
Dockerfile \
.dockerignore \
assets \
setup.py \
README.md \
LICENSE \
--exclude="*.pyc" \
--exclude="__pycache__/*" \
--exclude="*.DS_Store" \
--exclude=".git/*"
# Create checksums
cd dist
sha256sum fractum-${STEPS_GET_VERSION_OUTPUTS_VERSION}-source.zip > checksums.txt
env:
STEPS_GET_VERSION_OUTPUTS_VERSION: ${{ steps.get_version.outputs.version }}
- name: Extract release notes from tag
id: release_notes
run: |
TAG="${GITHUB_EVENT_INPUTS_TAG}"
# Extract release notes from signed tag message
NOTES=$(git tag -l --format='%(contents)' $TAG)
echo "notes<<EOF" >> $GITHUB_OUTPUT
echo "$NOTES" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
env:
GITHUB_EVENT_INPUTS_TAG: ${{ github.event.inputs.tag }}
- name: Create GitHub Release
uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 # v2.2.2
with:
tag_name: ${{ steps.get_version.outputs.tag }}
name: Fractum ${{ steps.get_version.outputs.tag }}
body: |
## 🔐 Security Verification
**GPG Signature:** ✅ This release is cryptographically signed
**Key ID:** D009F6290DCFDAB6
**Signed by:** S.A.S.U. KATVIO (Fractum Release Signing)
### Verify Release Authenticity
```bash
# Import KATVIO public key
curl -O https://fractum.katvio.com/fractum-signing-key.asc
gpg --import fractum-signing-key.asc
# Verify tag signature
git tag -v ${{ steps.get_version.outputs.tag }}
# Verify package checksum
sha256sum -c checksums.txt
```
## 📋 Release Notes
${{ steps.release_notes.outputs.notes }}
## 📦 Download Options
- **Source Code:** Use git clone or download ZIP
- **Verification:** Always verify GPG signatures before use
files: |
dist/*
draft: false
prerelease: false
make_latest: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update website release info
run: |
echo "🚀 Released Fractum ${STEPS_GET_VERSION_OUTPUTS_VERSION}"
echo "Tag: ${STEPS_GET_VERSION_OUTPUTS_TAG}"
echo "Signature verified: ✅"
env:
STEPS_GET_VERSION_OUTPUTS_VERSION: ${{ steps.get_version.outputs.version }}
STEPS_GET_VERSION_OUTPUTS_TAG: ${{ steps.get_version.outputs.tag }}