11name : Create Release
22
33on :
4- push :
5- tags :
6- - ' v*' # Trigger on any tag starting with 'v'
4+ workflow_dispatch :
5+ inputs :
6+ tag :
7+ description : ' Git tag to release (e.g., v1.2.3)'
8+ required : true
9+ type : string
710
811jobs :
912 verify-and-release :
@@ -13,22 +16,70 @@ jobs:
1316 uses : actions/checkout@v4
1417 with :
1518 fetch-depth : 0
19+ fetch-tags : true
20+
21+ - name : Validate tag format
22+ run : |
23+ TAG="${{ github.event.inputs.tag }}"
24+ if [[ ! $TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
25+ echo "❌ Invalid tag format. Expected format: v1.2.3"
26+ exit 1
27+ fi
28+ echo "✅ Tag format is valid: $TAG"
29+
30+ - name : Verify tag exists
31+ run : |
32+ TAG="${{ github.event.inputs.tag }}"
33+ if ! git rev-parse --verify "refs/tags/$TAG" >/dev/null 2>&1; then
34+ echo "❌ Tag '$TAG' does not exist in the repository"
35+ echo "Available tags:"
36+ git tag --sort=-version:refname | head -10
37+ exit 1
38+ fi
39+ echo "✅ Tag '$TAG' exists"
40+
41+ - name : Checkout specific tag
42+ run : |
43+ git checkout ${{ github.event.inputs.tag }}
1644
1745 - name : Verify GPG signature on tag
1846 run : |
47+ TAG="${{ github.event.inputs.tag }}"
48+
49+ # Force fetch the complete tag object (not just commit reference)
50+ echo "=== Fetching Tag Object ==="
51+ git fetch origin tag $TAG --force
52+
53+ # Debug: Show what type of object we have
54+ echo "=== Tag Object Debug ==="
55+ git cat-file -t $TAG
56+ echo "Tag points to commit: $(git rev-parse $TAG^{})"
57+ echo "Tag object hash: $(git rev-parse $TAG)"
58+ echo "=== End Tag Debug ==="
59+
1960 # Import public key for verification
20- echo "${{ secrets.GPG_PUBLIC_KEY }}" | gpg --import
61+ echo "=== Importing GPG Key ==="
62+ echo '${{ secrets.GPG_PUBLIC_KEY }}' > /tmp/pubkey.asc
63+ head -3 /tmp/pubkey.asc
64+ gpg --import /tmp/pubkey.asc
65+ echo "=== GPG Key Imported ==="
2166
2267 # Verify the tag is properly signed
23- git tag -v ${{ github.ref_name }}
68+ echo "=== Verifying Tag Signature ==="
69+ git tag -v $TAG
2470
2571 echo "✅ Tag signature verified"
72+
73+ # Cleanup
74+ rm /tmp/pubkey.asc
2675
2776 - name : Get version from tag
2877 id : get_version
2978 run : |
30- VERSION=${GITHUB_REF#refs/tags/v}
79+ TAG="${{ github.event.inputs.tag }}"
80+ VERSION=${TAG#v}
3181 echo "version=$VERSION" >> $GITHUB_OUTPUT
82+ echo "tag=$TAG" >> $GITHUB_OUTPUT
3283
3384 - name : Package repository
3485 run : |
@@ -55,17 +106,18 @@ jobs:
55106 - name : Extract release notes from tag
56107 id : release_notes
57108 run : |
109+ TAG="${{ github.event.inputs.tag }}"
58110 # Extract release notes from signed tag message
59- NOTES=$(git tag -l --format='%(contents)' ${{ github.ref_name }} )
111+ NOTES=$(git tag -l --format='%(contents)' $TAG )
60112 echo "notes<<EOF" >> $GITHUB_OUTPUT
61113 echo "$NOTES" >> $GITHUB_OUTPUT
62114 echo "EOF" >> $GITHUB_OUTPUT
63115
64116 - name : Create GitHub Release
65117 uses : softprops/action-gh-release@v2.2.2
66118 with :
67- tag_name : ${{ github.ref_name }}
68- name : Fractum ${{ github.ref_name }}
119+ tag_name : ${{ steps.get_version.outputs.tag }}
120+ name : Fractum ${{ steps.get_version.outputs.tag }}
69121 body : |
70122 ## 🔐 Security Verification
71123
80132 gpg --import fractum-signing-key.asc
81133
82134 # Verify tag signature
83- git tag -v ${{ github.ref_name }}
135+ git tag -v ${{ steps.get_version.outputs.tag }}
84136
85137 # Verify package checksum
86138 sha256sum -c checksums.txt
@@ -104,5 +156,5 @@ jobs:
104156 - name : Update website release info
105157 run : |
106158 echo "🚀 Released Fractum ${{ steps.get_version.outputs.version }}"
107- echo "Tag: ${{ github.ref_name }}"
159+ echo "Tag: ${{ steps.get_version.outputs.tag }}"
108160 echo "Signature verified: ✅"
0 commit comments