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
30 changes: 30 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
on:
push:
branches:
- master
- development
pull_request:
workflow_dispatch:

jobs:
test:
name: Test
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/[email protected]
with:
submodules: recursive
- name: Setup Node.js
uses: actions/[email protected]
with:
node-version: '25.8.2'
- name: Install dependencies
run: npm install
- name: Run headless test
uses: GabrielBB/[email protected]
with:
run: npm test
141 changes: 141 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
on:
workflow_dispatch:
inputs:
bump:
description: 'Tipo de bump de versão'
required: true
type: choice
options:
- patch
- minor
- major
suffix:
description: 'Sufixo de pré-lançamento: alpha, beta ou rc (opcionalmente com índice, ex.: rc-1)'
required: false
type: string
default: ''

jobs:
release:
name: Publish and release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Generate GitHub App token
id: generate-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ vars.CI_APP_ID }}
private-key: ${{ secrets.CI_APP_PRIVATE_KEY }}
- name: Checkout
uses: actions/[email protected]
with:
token: ${{ steps.generate-token.outputs.token }}
fetch-depth: 0
- name: Validate release channel and branch
run: |
BRANCH="${GITHUB_REF_NAME}"
SUFFIX="${{ inputs.suffix }}"

if [ -z "$SUFFIX" ]; then
if [ "$BRANCH" != "main" ]; then
echo "Release estável (sem sufixo) só pode ser executado na branch main."
exit 1
fi
exit 0
fi

if [[ ! "$SUFFIX" =~ ^(alpha|beta|rc)(-[0-9]+)?$ ]]; then
echo "Sufixo inválido: '$SUFFIX'. Valores permitidos: alpha, beta, rc (com índice opcional, ex.: rc-1) ou vazio."
exit 1
fi

CHANNEL="${SUFFIX%%-*}"

if [ "$CHANNEL" = "beta" ] || [ "$CHANNEL" = "rc" ]; then
if [ "$BRANCH" != "development" ]; then
echo "Pré-release ($SUFFIX) só pode ser executado na branch development."
exit 1
fi
exit 0
fi

if [ "$CHANNEL" = "alpha" ]; then
if [ "$BRANCH" = "main" ] || [ "$BRANCH" = "development" ]; then
echo "Pré-release ($SUFFIX) não pode ser executado nas branches main ou development."
exit 1
fi
exit 0
fi
- name: Calculate new version
id: release_tag
run: |
CURRENT=$(jq -r '.version' package.json | sed 's/-.*//')
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT"

case "${{ inputs.bump }}" in
major) MAJOR=$((MAJOR + 1)); MINOR=0; PATCH=0 ;;
minor) MINOR=$((MINOR + 1)); PATCH=0 ;;
patch) PATCH=$((PATCH + 1)) ;;
esac

VERSION="$MAJOR.$MINOR.$PATCH"
SUFFIX="${{ inputs.suffix }}"
if [ -n "$SUFFIX" ]; then
VERSION="$VERSION-$SUFFIX"
fi

TAG="$VERSION"

git fetch --tags --force
if git ls-remote --exit-code --tags origin "refs/tags/$TAG" > /dev/null 2>&1; then
echo "Tag já existe no remoto: $TAG"
exit 1
fi

echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Setup Node.js
uses: actions/[email protected]
with:
node-version: '20'
- name: Install dependencies
run: npm ci
- name: Set package version from input tag
run: npm version ${{ steps.release_tag.outputs.version }} --no-git-tag-version
- name: Resolve publish arguments
id: publish_args
run: |
ARGS="publish -p $VSCE_TOKEN"

if [ -n "${{ inputs.suffix }}" ]; then
ARGS="$ARGS --pre-release"
fi

echo "args=$ARGS" >> "$GITHUB_OUTPUT"
# - name: Publish extension
# uses: JCofman/[email protected]
# env:
# VSCE_TOKEN: ${{ secrets.VSCE_TOKEN }}
# with:
# args: ${{ steps.publish_args.outputs.args }}
- name: Configure Git user
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Commit release version
run: |
git add package.json package-lock.json 2>/dev/null || git add package.json
git commit -m "chore(release): ${{ steps.release_tag.outputs.tag }} [skip ci]"
- name: Create and push tag
run: |
git tag "${{ steps.release_tag.outputs.tag }}"
git push origin HEAD
git push origin "${{ steps.release_tag.outputs.tag }}"
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.release_tag.outputs.tag }}
generate_release_notes: true
prerelease: ${{ inputs.suffix != '' }}
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
node_modules/
jsconfig.json
.eslintrc.json
test/
.vscode-test/
out/
dist/
package-lock.json
*.vsix
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "src/resources/locales"]
path = src/resources/locales
[submodule "resources/locales"]
path = resources/locales
url = https://github.com/citation-style-language/locales
3 changes: 3 additions & 0 deletions .vscode-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const { defineConfig } = require('@vscode/test-cli');

module.exports = defineConfig({ files: 'out/src/test/**/*.test.js' });
12 changes: 8 additions & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
]
"--extensionDevelopmentPath=${workspaceFolder}",
"--disable-extensions"
],
"preLaunchTask": "npm: compile"
},
{
"name": "Extension Tests",
Expand All @@ -21,8 +23,10 @@
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/test/suite/index"
]
"--extensionTestsPath=${workspaceFolder}/dist/test/suite/index",
"--disable-extensions"
],
"preLaunchTask": "npm: compile",
}
]
}
14 changes: 10 additions & 4 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
tsconfig.json
esbuild.js
.vscode-test.js
src/
out/
test/
node_modules/
.vscode/**
.vscode-test/**
test/**
.gitignore
vsc-extension-quickstart.md
**/jsconfig.json
.gitmodules
**/*.map
**/.eslintrc.json
**/*.ts
media/*.gif
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change Log

### 1.0.0

* Extension source language switched to TypeScript
* Major code refactoring
* Implemented ESBuild extension bundling
* Extension tests suite included

### 0.2.2

* Fixes [issue 12](https://github.com/igorjrd/vscode-cslpreview/issues/12)
Expand Down
Loading
Loading