Skip to content

Commit

Permalink
Merge pull request #300 from PDConSec:fix/tech-debt
Browse files Browse the repository at this point in the history
Fix/tech debt
  • Loading branch information
PeterWone authored May 12, 2024
2 parents c39e663 + 40a2c53 commit 062d1b9
Show file tree
Hide file tree
Showing 81 changed files with 4,522 additions and 9,764 deletions.
86 changes: 86 additions & 0 deletions .github/workflows/generated.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Build and Release

on:
workflow_dispatch:
inputs:
createRelease:
description: 'Create GitHub Release'
required: true
default: 'yes'
publishMarketplace:
description: 'Publish to Marketplace'
required: true
default: 'no'

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '14'

- name: Install Dependencies
run: npm ci

- name: Bundle with Webpack
run: npm run webpack

- name: Archive Production Artifact
uses: actions/upload-artifact@v3
with:
name: vscode-extension
path: ./dist

release:
if: ${{ github.event.inputs.createRelease == 'yes' }}
needs: build
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: vscode-extension

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

publish:
if: ${{ github.event.inputs.publishMarketplace == 'yes' }}
needs: release
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: vscode-extension

- name: Publish to Marketplace
uses: microsoft/vscode-github-release-notes@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AZURE_DEVOPS_EXT_PAT: ${{ secrets.AZURE_DEVOPS_EXT_PAT }}
with:
vscodeMarketplacePublisher: 'your-publisher-name'
vscodeMarketplaceExtensionId: 'your-extension-id'
79 changes: 47 additions & 32 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,46 +10,61 @@ on:
description: 'Publish to MS marketplace'
type: boolean
required: true
default: "true"
default: false
publishOVSX:
description: 'Publish to OpenVSX'
type: boolean
required: true
default: "false"
default: false
publishGH:
description: 'Publish to GitHub releases'
type: boolean
required: true
default: "true"
default: true

jobs:
package:
packageVSIX:
name: Package the extension
runs-on: ubuntu-latest
outputs:
packageName: ${{ steps.setup.outputs.packageName }}
tag: ${{ steps.setup-tag.outputs.tag }}
version: ${{ steps.setup-tag.outputs.version }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 18.x
registry-url: https://registry.npmjs.org/

- name: Install dependencies
run: npm i
run: npm ci

- name: Create l10n directory
run: |
mkdir ./l10n
- name: Extract localisable strings from app
run: |
npx @vscode/l10n-dev export --outDir ./l10n ./src
- name: Translate app strings
run: |
npx @vscode/l10n-dev generate-azure -o ./l10n/ ./l10n/bundle.l10n.json ./package.nls.json -l zh-Hans ja es ru pt fr ko zh-Hant it pl hu cs bg tr my ca lt hy
env:
AZURE_TRANSLATOR_KEY: ${{ secrets.AZURE_TRANSLATOR_KEY_FREE }}
AZURE_TRANSLATOR_REGION: global

- name: Setup package path
id: setup
run: echo "::set-output name=packageName::$(node -e "console.log(require('./package.json').name + '-' + require('./package.json').version + '.vsix')")"

- name: Package
- name: Bundle using Webpack
env:
VSIX_PACKAGE_PATH: ${{ steps.setup.outputs.packageName }}
run: npx gulp package
run: npx @vscode/vsce package

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: ${{ steps.setup.outputs.packageName }}
path: ${{ steps.setup.outputs.packageName }}
Expand All @@ -65,49 +80,49 @@ jobs:

- if: failure()
name: Delete tag
uses: pr-mpt/actions-delete-tag@v1
uses: prompt/actions-delete-tag@v1

publishMS:
name: Publish to MS marketplace
runs-on: ubuntu-latest
needs: package
needs: packageVSIX
if: github.event.inputs.publishMS == 'true'
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: ${{ needs.package.outputs.packageName }}
name: ${{ needs.packageVSIX.outputs.packageName }}
- name: Publish to MS marketplace
run: npx vsce publish --packagePath ./${{ needs.package.outputs.packageName }} -p ${{ secrets.AZUREDEVOPS_PRINT_RELEASE }}
run: vsce publish --packagePath ./${{ needs.packageVSIX.outputs.packageName }} -p ${{ secrets.AZUREDEVOPS_PRINT_RELEASE }}

publishOVSX:
name: Publish to OpenVSX
runs-on: ubuntu-latest
needs: package
needs: packageVSIX
if: github.event.inputs.publishOVSX == 'true'
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: ${{ needs.package.outputs.packageName }}
name: ${{ needs.packageVSIX.outputs.packageName }}
- name: Publish to OpenVSX
run: npx ovsx publish ./${{ needs.package.outputs.packageName }} -p ${{ secrets.OVSX_PAT }}
run: npx ovsx publish ./${{ needs.packageVSIX.outputs.packageName }} -p ${{ secrets.OVSX_PAT }}

publishGH:
name: Publish to GitHub releases
runs-on: ubuntu-latest
needs: package
needs: packageVSIX
if: github.event.inputs.publishGH == 'true'
steps:
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: ${{ needs.package.outputs.packageName }}
name: ${{ needs.packageVSIX.outputs.packageName }}

- name: Commit tagger
uses: tvdias/github-tagger@v0.0.2
with:
repo-token: ${{ secrets.PRINT_RELEASE }}
tag: ${{ needs.package.outputs.tag }}
tag: ${{ needs.packageVSIX.outputs.tag }}

- name: Create Release
id: create-release
Expand All @@ -116,15 +131,15 @@ jobs:
PRINT_RELEASE: ${{ secrets.PRINT_RELEASE }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ needs.package.outputs.tag }}
release_name: Release ${{ needs.package.outputs.version }}
tag_name: ${{ needs.packageVSIX.outputs.tag }}
release_name: Release ${{ needs.packageVSIX.outputs.version }}
draft: false
prerelease: false

- name: Upload assets to a Release
uses: AButler/upload-release-assets@v2.0
with:
files: ${{ needs.package.outputs.packageName }}
release-tag: ${{ needs.package.outputs.tag }}
files: ${{ needs.packageVSIX.outputs.packageName }}
release-tag: ${{ needs.packageVSIX.outputs.tag }}
repo-token: ${{ secrets.PRINT_RELEASE }}

59 changes: 0 additions & 59 deletions .github/workflows/test.yaml

This file was deleted.

4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ node_modules
.vscode-test/
*.vsix
/package.nls.*.json
vscode-print.log
vscode-print.log
doc/manual-*.md
bundle.*
5 changes: 5 additions & 0 deletions .vscode-test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { defineConfig } from '@vscode/test-cli';

export default defineConfig({
files: 'out/test/**/*.test.js',
});
5 changes: 0 additions & 5 deletions .vscode/extensions.json

This file was deleted.

49 changes: 14 additions & 35 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,16 @@
// A launch configuration that compiles the extension and then opens it inside a new window
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
],
"preLaunchTask": "npm: compile"
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"${workspaceFolder}/src/test/test-docs",
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
],
"outFiles": [
"${workspaceFolder}/out/test/**/*.js"
],
"preLaunchTask": "gulp-build"
}
]
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Translate",
"program": "${workspaceFolder}/app.js",
"args": [],
"skipFiles": [
"<node_internals>/**",
"node_modules/**"
] // Skip node internals during debugging
}
]
}
Loading

0 comments on commit 062d1b9

Please sign in to comment.