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
42 changes: 34 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,44 @@ on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Version to package (e.g. 1.2.3) — defaults to package.json'
required: false
publish:
description: 'Publish to VS Code Marketplace'
required: false
default: 'true'
type: choice
options: ['true', 'false']

jobs:
release:
name: Build, Test & Release
name: Package & Publish
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: npm

- name: Install dependencies
run: npm ci

- name: Sync version from tag
if: startsWith(github.ref, 'refs/tags/v')
run: npm version --no-git-tag-version "${GITHUB_REF_NAME#v}"

- name: Sync version from input
if: github.event_name == 'workflow_dispatch' && github.event.inputs.version != ''
run: npm version --no-git-tag-version "${{ github.event.inputs.version }}"

- name: Compile TypeScript
run: npm run compile

Expand All @@ -33,8 +51,16 @@ jobs:
- name: Package extension
run: npm run package

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: '*.vsix'
generate_release_notes: true
- name: Upload VSIX to GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
run: gh release upload "$GITHUB_REF_NAME" *.vsix --clobber
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish to VS Code Marketplace
if: >
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.publish == 'true')
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
run: npm run publish
43 changes: 43 additions & 0 deletions .github/workflows/semantic-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Semantic Release

on:
push:
branches: [main]

jobs:
release:
name: Semantic Release
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- uses: actions/setup-node@v4
with:
node-version: '20'
cache: npm

- name: Install dependencies
run: npm ci

- name: Compile TypeScript
run: npm run compile

- name: Run tests
run: npm test

- name: Semantic Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_AUTHOR_NAME: github-actions[bot]
GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com
GIT_COMMITTER_NAME: github-actions[bot]
GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com
run: npx semantic-release
13 changes: 13 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"branches": ["main"],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
["@semantic-release/npm", { "npmPublish": false }],
["@semantic-release/git", {
"assets": ["package.json", "package-lock.json"],
"message": "chore(release): ${nextRelease.version} [skip ci]"
}],
["@semantic-release/github", { "assets": [] }]
]
}
Loading
Loading