Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
402bdf6
fix: update documentation and remove obsolete images
twentyTwo May 25, 2025
beb1af1
fix: remove obsolete features and update settings section in README
twentyTwo May 25, 2025
ffcf772
add repository statistics workflow for automated metrics collection
twentyTwo May 31, 2025
a6aea91
Merge pull request #46 from twentyTwo/action/repo-stats
twentyTwo Jun 1, 2025
e6aa084
Add *.code-workspace files to git and vscode ignore files. (#31)
aholmes Jun 2, 2025
c3b47e1
refactor: enhance publish workflow with improved change detection and…
twentyTwo Jun 6, 2025
9d832c1
chore: clean up .gitignore and .vscodeignore, and remove obsolete .vs…
twentyTwo Jun 6, 2025
4353eb1
Add bare minimum ESLint config file. (#33)
aholmes Jun 6, 2025
f1a5f6f
Feature/git branch time tracking (#48)
twentyTwo Jun 6, 2025
51493e0
chore: update version to 0.4.1 in package.json
twentyTwo Jun 6, 2025
897908b
refactor: enhance publish workflow with detailed logging and diagnostics
twentyTwo Jun 6, 2025
0ea50a0
chore: update version to 0.4.2 in package.json
twentyTwo Jun 6, 2025
53f41a5
refactor: streamline publish workflow by removing redundant steps and…
twentyTwo Jun 6, 2025
a370461
chore: update version to 0.4.3 in package.json
twentyTwo Jun 6, 2025
541e65b
refactor: simplify publish step by removing dry run logic and enhanci…
twentyTwo Jun 8, 2025
892fee5
refactor: remove dry run input from workflow trigger
twentyTwo Jun 8, 2025
a12f0b3
chore: update version to 0.4.4 in package.json
twentyTwo Jun 8, 2025
8d9094c
Add option to configue week start day
zyrikby Jun 9, 2025
60b81f7
Update README and description
zyrikby Jun 9, 2025
b91fb49
Merge branch 'feature/start_of_week' into main
zyrikby Jun 9, 2025
50ada05
Add statistics about previous periods
zyrikby Jun 9, 2025
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
7 changes: 7 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
}
}
267 changes: 183 additions & 84 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,112 +1,211 @@
name: Publish Extension to Visual Studio Marketplace
run-name: Publish VS Code Extension

on:
push:
branches:
- main
paths-ignore:
- '.github/workflows/**' # Ignore changes to workflow files
workflow_dispatch: # Allow manual trigger
branches: [main]
paths-ignore: ['.github/workflows/**']
workflow_dispatch:

jobs:
verify-changes:
validate:
name: Validate Changes
runs-on: ubuntu-latest
outputs:
should_publish: ${{ steps.check-changes.outputs.should_publish }}

should_publish: ${{ steps.changes.outputs.should_publish }}
version: ${{ steps.version.outputs.current }}
skip_reason: ${{ steps.changes.outputs.skip_reason }}
has_code_changes: ${{ steps.changes.outputs.has_code_changes }}

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all tags and branches

- name: Get changed files
id: changed-files
fetch-depth: 2
- name: Checked out code
run: |
echo "✅ Code checked out. Current directory: $(pwd)"
echo "Files:"
ls -la

- name: Get version info
id: version
run: |
echo "files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | tr '\n' ' ')" >> $GITHUB_OUTPUT

- name: Check version change and file types
id: check-changes
echo "🔍 Reading package.json version..."
CURRENT=$(node -p "require('./package.json').version")
echo "current=$CURRENT" >> $GITHUB_OUTPUT
echo "✨ Current version: $CURRENT"
echo "📦 Package.json contents:"
cat package.json
- name: Version info
run: |
echo "Version info step complete."

- name: Analyze changes
id: changes
run: |
# Check if package.json version changed
VERSION_CHANGED=$(git diff ${{ github.event.before }} ${{ github.event.after }} package.json | grep '+\s*"version"')

# Get list of changed files
CHANGED_FILES="${{ steps.changed-files.outputs.files }}"

# Check if only documentation files were changed
DOCS_ONLY=true
for file in $CHANGED_FILES; do
if [[ ! $file =~ \.(md|txt|doc|docx)$ ]] && [[ ! $file =~ ^docs/ ]]; then
DOCS_ONLY=false
break
echo "🔎 Analyzing changes between commits..."
VERSION_UPDATED=$(git diff HEAD^ HEAD -- package.json | grep -q '"version":' && echo "true" || echo "false")
CODE_CHANGES=$(git diff --name-only HEAD^ HEAD | \
grep -vE '\\.(md|txt)$|^docs/|^\\.github/|^\\.vscode/|package\\.json$' || echo "")
DOC_CHANGES=$(git diff --name-only HEAD^ HEAD | \
grep -E '\\.(md|txt)$|^docs/' || echo "")
echo "has_code_changes=${CODE_CHANGES:+true}" >> $GITHUB_OUTPUT
echo "has_doc_changes=${DOC_CHANGES:+true}" >> $GITHUB_OUTPUT
echo "Code changes: $CODE_CHANGES"
echo "Doc changes: $DOC_CHANGES"
if [[ "$VERSION_UPDATED" == "true" ]]; then
if [[ -n "$CODE_CHANGES" ]]; then
echo "should_publish=true" >> $GITHUB_OUTPUT
echo "skip_reason=" >> $GITHUB_OUTPUT
echo "✅ Publishing needed: Version update detected with code changes"
else
echo "should_publish=false" >> $GITHUB_OUTPUT
echo "skip_reason=Version update without code changes" >> $GITHUB_OUTPUT
echo "⚠️ Version update detected but no code changes found"
fi
done

# Initialize should_publish as false
echo "should_publish=false" >> $GITHUB_OUTPUT

if [[ "$DOCS_ONLY" == "true" ]]; then
echo "ℹ️ Only documentation files were changed"
echo "should_publish=false" >> $GITHUB_OUTPUT
elif [[ -z "$VERSION_CHANGED" ]]; then
echo "❌ Version in package.json was not updated"
echo "should_publish=false" >> $GITHUB_OUTPUT
else
echo "✅ Version changed and non-documentation files modified"
echo "should_publish=true" >> $GITHUB_OUTPUT
if [[ -n "$CODE_CHANGES" ]]; then
echo "should_publish=false" >> $GITHUB_OUTPUT
echo "skip_reason=Code changes without version update" >> $GITHUB_OUTPUT
echo "❌ Code changes detected without version update"
exit 1
else
echo "should_publish=false" >> $GITHUB_OUTPUT
if [[ -n "$DOC_CHANGES" ]]; then
echo "skip_reason=Documentation only changes" >> $GITHUB_OUTPUT
echo "ℹ️ Documentation only changes detected"
else
echo "skip_reason=No significant changes" >> $GITHUB_OUTPUT
echo "ℹ️ No significant changes detected"
fi
fi
fi
- name: Analyze changes
run: echo "Analyze changes step complete."

publish:
needs: verify-changes
if: needs.verify-changes.outputs.should_publish == 'true'
build-and-package:
name: Build and Package
needs: validate
if: needs.validate.outputs.should_publish == 'true'
runs-on: ubuntu-latest
environment: VSC EXT

outputs:
vsix_path: ${{ steps.package.outputs.path }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18'

- name: Install dependencies
run: npm ci

- name: Compile
run: npm run compile

- name: Install vsce
run: npm install -g @vscode/vsce

- name: Clean existing VSIX files
run: rm -f *.vsix

- name: Package Extension
run: vsce package

- name: Get Package Info
- name: Install and build
run: |
npm ci
npm run compile
npm install -g @vscode/vsce
- name: Package extension
id: package
run: |
VERSION=$(node -p "require('./package.json').version")
VSIX_PATH="simple-coding-time-tracker-${VERSION}.vsix"
if [ ! -f "$VSIX_PATH" ]; then
echo "Error: Expected VSIX file $VSIX_PATH not found"
VERSION="${{ needs.validate.outputs.version }}"
VSIX_NAME="simple-coding-time-tracker-${VERSION}.vsix"
rm -f *.vsix
vsce package
if [ ! -f "$VSIX_NAME" ]; then
echo "::error::Failed to create VSIX package"
exit 1
fi
echo "Package created: $VSIX_PATH"
echo "vsix_path=$VSIX_PATH" >> $GITHUB_OUTPUT
echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
echo "version=$VERSION" >> $GITHUB_OUTPUT

- name: Upload VSIX as artifact
echo "path=$VSIX_NAME" >> $GITHUB_OUTPUT
echo "✅ Package created: $VSIX_NAME"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: extension-release-v${{ steps.package.outputs.version }}-${{ steps.package.outputs.date }}
path: "*.vsix"
retention-days: 99 # Maximum retention period allowed by GitHub

- name: Publish to Visual Studio Marketplace
run: vsce publish -p "${{ secrets.VSC_PAT }}"
name: extension-v${{ needs.validate.outputs.version }}
path: ${{ steps.package.outputs.path }}
retention-days: 90

publish:
name: Publish to Marketplace
needs: [validate, build-and-package]
runs-on: ubuntu-latest
# environment: vscode-marketplace
outputs:
status: ${{ steps.publish.outputs.status }}
error_detail: ${{ steps.publish.outputs.error_detail }}

steps:
- name: Download package
uses: actions/download-artifact@v4
with:
name: extension-v${{ needs.validate.outputs.version }}

- name: Checkout source code
uses: actions/checkout@v4

- name: Install vsce
run: |
npm install -g @vscode/vsce
vsce --version

- name: Diagnostic check
run: |
echo "🔍 Environment Information"
echo "Node version: $(node -v)"
echo "NPM version: $(npm -v)"
echo "VSCE version: $(vsce --version)"
echo "Package.json version: $(node -p 'require(\'./package.json\').version' 2>/dev/null || echo 'Not found')"
echo "Current directory: $(pwd)"
ls -la
echo "VSIX files:"
ls -lh *.vsix || echo "No VSIX file found"

- name: Publish to marketplace
id: publish
continue-on-error: true
env:
VSC_PAT: ${{ secrets.VSC_PAT }}
run: |
VERSION="${{ needs.validate.outputs.version }}"
echo "🔍 Publish v${VERSION}"
echo "VSC_PAT is ${VSC_PAT:+set}"

echo "🚀 Running vsce publish..."
echo "VSIX files before publish:"
ls -lh *.vsix || echo "No VSIX file found"
echo "Package.json present: $(test -f package.json && echo yes || echo no)"

OUTPUT=$(vsce publish -p "$VSC_PAT" 2>&1)
EXIT_CODE=$?

echo "📝 vsce publish output:"
echo "$OUTPUT"
echo "Exit code: $EXIT_CODE"

if [ $EXIT_CODE -eq 0 ]; then
echo "status=success" >> $GITHUB_OUTPUT
echo "✅ Publish succeeded."
elif [[ "$OUTPUT" == *"already exists"* ]]; then
echo "status=exists" >> $GITHUB_OUTPUT
echo "ℹ️ Version already exists."
else
echo "status=failed" >> $GITHUB_OUTPUT
ERROR_DETAIL=$(echo "$OUTPUT" | grep -v "error" | tail -n 1)
echo "error_detail=$ERROR_DETAIL" >> $GITHUB_OUTPUT
echo "❌ Publish failed: $ERROR_DETAIL"
fi

- name: Publish step complete
run: echo "Publish step complete."

- name: Create and push Git tag
if: steps.publish.outputs.status == 'success'
run: |
VERSION="${{ needs.validate.outputs.version }}"
echo "🏷️ Creating git tag v${VERSION}..."
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Actions"
git tag -a "v${VERSION}" -m "Release v${VERSION}"
git push origin "v${VERSION}"
echo "✅ Git tag pushed."

- name: Tag step complete
if: steps.publish.outputs.status == 'success'
run: echo "Tag step complete."

29 changes: 29 additions & 0 deletions .github/workflows/repo-stats.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Repository Statistics
run-name: 📊 Collect Repository Metrics

on:
schedule:
# Runs every 2nd day at 02:00 UTC (less busy time)
- cron: '0 2 */2 * *'
workflow_dispatch: # Allow manual trigger for testing

permissions:
contents: write # Needed to write stats data
pull-requests: read
issues: read

jobs:
repo-stats:
name: Generate Repository Statistics
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Generate repository statistics
uses: jgehrcke/github-repo-stats@RELEASE
with:
repository: ${{ github.repository }}
ghtoken: ${{ secrets.REPO_STATS_TOKEN }} # Use custom PAT instead
databranch: stats-data
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
node_modules
out
**/*.code-workspace
dist
28 changes: 23 additions & 5 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,20 +1,38 @@
# Development directories
.vscode/**
.vscode-test/**
src/**
out/test/**
test/**
scripts/**
images/**

# Source control
.git/**
.github/**
.gitignore

# Configuration files
.yarnrc
tsconfig.json
.eslintrc.json
webpack.config.js

# Build artifacts
**/*.map
**/*.ts
**/*.vsix

# Documentation (except README)
CONTRIBUTING.md
TECHNICAL.md
.github/**
**/*.vsix
webpack.config.js

# Dependencies (except type definitions)
node_modules/**
!node_modules/@types/
!node_modules/@types/

# Keep these files
!LICENSE
!README.md
!package.json
!icon-sctt.png
!out/src/**/*.js
Loading