Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
TilakMaddy committed Feb 20, 2025
1 parent 5297e33 commit 2fe671e
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,11 @@ jobs:
- name: Check .vsix file existence
run: test -f ${{ env.VSIX_FILE }} || (echo ".vsix file not found!" && exit 1)

- name: Set up GitHub token
run: echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV

- name: Run release script
run: |
chmod +x ./generate_release.sh
./generate_release.sh $(echo $GITHUB_REF | sed 's/refs\/tags\///')
44 changes: 44 additions & 0 deletions generate_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

# Ensure the script is run with a version argument
if [ -z "$1" ]; then
echo "Please provide a version (e.g., 1.0.1)"
exit 1
fi

VERSION=$1

# Create a new tag for the release
git tag "v$VERSION"
git push origin "v$VERSION"

# Generate the changelog from the last release tag to the current commit
CHANGELOG=$(git log --oneline --no-merges $(git describe --tags --abbrev=0)..HEAD)

# Create a release note body
RELEASE_BODY="## v$VERSION - Release Notes\n\n### What's New\n\n$CHANGELOG\n\n### Installation\n- Download the `.vsix` file and install it manually in VS Code."

# Create the release using GitHub API
RESPONSE=$(curl -X POST -H "Authorization: token $GITHUB_TOKEN" \
-d "{\"tag_name\":\"v$VERSION\", \"name\":\"Release v$VERSION\", \"body\":\"$RELEASE_BODY\", \"draft\":false, \"prerelease\":false}" \
https://api.github.com/repos/Cyfrin/vscode-adeyn/releases)

# Extract the upload URL from the response
UPLOAD_URL=$(echo $RESPONSE | jq -r .upload_url | sed -e "s/{?name,label}//")

# Find the `.vsix` file (adjust to your actual file path or naming convention)
VSIX_FILE=$(ls *.vsix | head -n 1)

if [ -z "$VSIX_FILE" ]; then
echo "No .vsix file found to upload"
exit 1
fi

# Upload the .vsix file to the release
curl -X POST -H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/zip" \
--data-binary @"$VSIX_FILE" \
"$UPLOAD_URL?name=$VSIX_FILE"

echo "Release created and .vsix asset uploaded for v$VERSION."

0 comments on commit 2fe671e

Please sign in to comment.