Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 35 additions & 23 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
branches: [main]

env:
NODE_VERSION: '18'
NODE_VERSION: '20'

jobs:
test:
Expand Down Expand Up @@ -59,7 +59,9 @@ jobs:
COMMIT_SHORT="${{ github.sha }}"
COMMIT_SHORT="${COMMIT_SHORT:0:7}"

curl -H "Content-Type: application/json" -X POST "$DISCORD_WEBHOOK" -d @- << EOF
TIMESTAMP=$(date -u +%Y-%m-%dT%H:%M:%S.000Z)

cat > payload.json << EOF
{
"embeds": [{
"title": "🧪 AI Commit Generator - Test Phase",
Expand All @@ -82,10 +84,13 @@ jobs:
"inline": true
}
],
"timestamp": "$(date -u +%Y-%m-%dT%H:%M:%S.000Z)"
"timestamp": "$TIMESTAMP"
}]
}
EOF

curl -H "Content-Type: application/json" -X POST "$DISCORD_WEBHOOK" -d @payload.json
rm payload.json
fi

publish:
Expand All @@ -110,8 +115,8 @@ jobs:
rm -rf node_modules package-lock.json
npm install

- name: Install VSCE
run: npm install -g vsce
- name: Install VSCE (latest)
run: npm install -g @vscode/vsce@latest

- name: Check version changes
id: version-check
Expand All @@ -133,7 +138,9 @@ jobs:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
run: |
if [ -n "$DISCORD_WEBHOOK" ]; then
curl -H "Content-Type: application/json" -X POST "$DISCORD_WEBHOOK" -d @- << EOF
TIMESTAMP=$(date -u +%Y-%m-%dT%H:%M:%S.000Z)

cat > payload.json << EOF
{
"embeds": [{
"title": "⚠️ AI Commit Generator - Version Skipped",
Expand All @@ -151,29 +158,32 @@ jobs:
"inline": true
}
],
"timestamp": "$(date -u +%Y-%m-%dT%H:%M:%S.000Z)"
"timestamp": "$TIMESTAMP"
}]
}
EOF

curl -H "Content-Type: application/json" -X POST "$DISCORD_WEBHOOK" -d @payload.json
rm payload.json
fi

- name: Package extension
- name: Package extension with VSCE
if: steps.version-check.outputs.version_changed == 'true'
run: |
npm run package
vsce package
vsce package --no-dependencies

- name: Publish to Visual Studio Marketplace
if: steps.version-check.outputs.version_changed == 'true'
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
run: |
vsce publish --pat $VSCE_PAT
vsce publish --pat $VSCE_PAT --no-dependencies

- name: Create GitHub Release
if: steps.version-check.outputs.version_changed == 'true'
id: create-release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand All @@ -198,21 +208,15 @@ jobs:
files: |
./ai-commit-generator-${{ steps.version-check.outputs.current_version }}.vsix

- name: Create Git Tag
if: steps.version-check.outputs.version_changed == 'true'
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git tag v${{ steps.version-check.outputs.current_version }}
git push origin v${{ steps.version-check.outputs.current_version }}

- name: Send Discord notification - Success
if: steps.version-check.outputs.version_changed == 'true' && success()
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
run: |
if [ -n "$DISCORD_WEBHOOK" ]; then
curl -H "Content-Type: application/json" -X POST "$DISCORD_WEBHOOK" -d @- << EOF
TIMESTAMP=$(date -u +%Y-%m-%dT%H:%M:%S.000Z)

cat > payload.json << EOF
{
"embeds": [{
"title": "🚀 AI Commit Generator - Published Successfully!",
Expand All @@ -238,10 +242,13 @@ jobs:
"footer": {
"text": "Deployed by ${{ github.actor }}"
},
"timestamp": "$(date -u +%Y-%m-%dT%H:%M:%S.000Z)"
"timestamp": "$TIMESTAMP"
}]
}
EOF

curl -H "Content-Type: application/json" -X POST "$DISCORD_WEBHOOK" -d @payload.json
rm payload.json
fi

- name: Send Discord notification - Failure
Expand All @@ -250,7 +257,9 @@ jobs:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
run: |
if [ -n "$DISCORD_WEBHOOK" ]; then
curl -H "Content-Type: application/json" -X POST "$DISCORD_WEBHOOK" -d @- << EOF
TIMESTAMP=$(date -u +%Y-%m-%dT%H:%M:%S.000Z)

cat > payload.json << EOF
{
"embeds": [{
"title": "❌ AI Commit Generator - Publish Failed",
Expand All @@ -276,8 +285,11 @@ jobs:
"footer": {
"text": "Attempted by ${{ github.actor }}"
},
"timestamp": "$(date -u +%Y-%m-%dT%H:%M:%S.000Z)"
"timestamp": "$TIMESTAMP"
}]
}
EOF

curl -H "Content-Type: application/json" -X POST "$DISCORD_WEBHOOK" -d @payload.json
rm payload.json
fi
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ Run the "Open AI Commit Config" command to create a configuration file.

```bash
# Clone repository
git clone <repository-url>
git clone https://github.com/DTDucas/ai-commit
cd ai-commit-generator

# Install dependencies
Expand Down