fix: fixing release script

This commit is contained in:
Kacper Kula 2025-05-22 11:34:15 +01:00
parent 4fa0735476
commit 238675cbf1

View file

@ -1,8 +1,16 @@
#!/bin/bash
# Get Release Notes
version="${{ steps.package-version.outputs.VERSION }}"
# Get version - you'll need to pass this as an argument or set it another way
version="${1:-$(cat package.json | grep '"version":' | sed -E 's/.*"version": "([^"]+)".*/\1/')}"
if [ -z "$version" ]; then
echo "Error: No version specified. Pass version as argument or ensure package.json exists."
exit 1
fi
echo "Processing version: $version"
# Get Release Notes
awk -v version="$version" '
BEGIN { found=0; content="" }
/^# [0-9]+\.[0-9]+\.[0-9]+/ {
@ -13,16 +21,17 @@ found { content = content $0 "\n" }
END { printf "%s", content }
' CHANGELOG.md > release_notes.txt
cat release_notes.txt >> $NOTES
# Set NOTES variable to the content of release_notes.txt
NOTES=$(cat release_notes.txt)
# Create and push tag
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git tag -a "${{version}}" -m "Release version ${{version}}"
git push origin "${{version}}"
git tag -a "$version" -m "Release version $version"
git push origin "$version"
# Create release
gh release create "${{version}}" \
--title="${{version}}" \
--notes="${{ NOTES }}" \
gh release create "$version" \
--title="$version" \
--notes="$NOTES" \
main.js manifest.json styles.css