@daiyam/artifact-vsx-ts 0.6.1 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,28 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ // Get version from command line argument (with 'v' prefix)
5
+ const version = process.argv[2];
6
+
7
+ try {
8
+ const changelog = fs.readFileSync(path.join(process.cwd(), 'CHANGELOG.md'), 'utf8');
9
+
10
+ // Regular expression to match a version section with the date
11
+ // Matches from "## v0.8.1 | 2025-04-23" until the next ## or end of file
12
+ const versionRegex = new RegExp(`## ${version} \\| \\d{4}-\\d{2}-\\d{2}[^#]*(?=## |$)`, 's');
13
+
14
+ const match = changelog.match(versionRegex);
15
+
16
+ if (match) {
17
+ // Remove the version header and trim whitespace
18
+ const notes = match[0].replace(/^## v\d+\.\d+\.\d+ \| \d{4}-\d{2}-\d{2}\n/, '').trim();
19
+ console.log(notes);
20
+ process.exit(0);
21
+ } else {
22
+ console.error(`No changelog entry found for version ${version}`);
23
+ process.exit(1);
24
+ }
25
+ } catch (error) {
26
+ console.error('Error reading CHANGELOG.md:', error);
27
+ process.exit(1);
28
+ }
@@ -1,27 +1,130 @@
1
1
  name: Publish Extension
2
+
2
3
  on:
4
+ workflow_dispatch:
3
5
  push:
4
6
  tags:
5
7
  - "*"
8
+
9
+ env:
10
+ PUBLISH_OPENVSX: ${{ vars.PUBLISH_OPENVSX }}
11
+ PUBLISH_VSCODE: ${{ vars.PUBLISH_VSCODE }}
12
+
6
13
  jobs:
7
14
  publish:
8
15
  runs-on: ubuntu-latest
9
16
  steps:
10
- - uses: actions/checkout@v4
11
- - uses: actions/setup-node@v4
17
+ - name: Checkout code
18
+ uses: actions/checkout@v4
19
+ with:
20
+ fetch-depth: 0
21
+
22
+ - name: Get Version
23
+ run: |
24
+ # Get the latest tag
25
+ git fetch --tags
26
+ LATEST_TAG=$(git describe --tags --abbrev=0)
27
+ if [ -z "$LATEST_TAG" ]; then
28
+ echo "No tags found in the repository"
29
+ exit 1
30
+ fi
31
+ echo "VERSION=$LATEST_TAG" >> $GITHUB_ENV
32
+ echo "Using version: $LATEST_TAG"
33
+
34
+ - name: Check Existing Release
35
+ run: |
36
+ # Try to get the release information
37
+ RELEASE_INFO=$(gh release view ${{ env.VERSION }} --json assets,url 2>/dev/null || echo "")
38
+ if [ ! -z "$RELEASE_INFO" ]; then
39
+ echo "Release exists"
40
+ echo "RELEASE_EXISTS=yes" >> $GITHUB_ENV
41
+ # Get the VSIX asset URL from the release
42
+ VSIX_URL=$(echo $RELEASE_INFO | jq -r '.assets[] | select(.name | endswith(".vsix")) | .url')
43
+ if [ ! -z "$VSIX_URL" ]; then
44
+ echo "Found existing VSIX file"
45
+ echo "VSIX_URL=$VSIX_URL" >> $GITHUB_ENV
46
+ echo "VSIX_NAME=$(echo $RELEASE_INFO | jq -r '.assets[] | select(.name | endswith(".vsix")) | .name')" >> $GITHUB_ENV
47
+ fi
48
+ else
49
+ echo "RELEASE_EXISTS=no" >> $GITHUB_ENV
50
+ fi
51
+ env:
52
+ GH_TOKEN: ${{ github.token }}
53
+
54
+ - name: Download Existing VSIX
55
+ if: env.RELEASE_EXISTS == 'yes' && env.VSIX_URL != ''
56
+ run: |
57
+ gh api ${{ env.VSIX_URL }} --header 'Accept: application/octet-stream' > ${{ env.VSIX_NAME }}
58
+ echo "CHECKSUM=$(sha256sum ${{ env.VSIX_NAME }} | cut -d ' ' -f 1)" >> $GITHUB_ENV
59
+ env:
60
+ GH_TOKEN: ${{ github.token }}
61
+
62
+ - name: Setup Node.js
63
+ if: env.RELEASE_EXISTS == 'no'
64
+ uses: actions/setup-node@v4
12
65
  with:
13
66
  node-version: 20
14
- - run: npm ci
67
+
68
+ - name: Build
69
+ if: env.RELEASE_EXISTS == 'no'
70
+ run: |
71
+ npm ci
72
+ npm install -g @vscode/vsce
73
+ npm run package
74
+ VSIX_NAME=$(ls *.vsix)
75
+ CHECKSUM=$(sha256sum $VSIX_NAME | cut -d ' ' -f 1)
76
+ echo "VSIX_NAME=$VSIX_NAME" >> $GITHUB_ENV
77
+ echo "CHECKSUM=$CHECKSUM" >> $GITHUB_ENV
78
+ echo "$CHECKSUM" > "$VSIX_NAME.sha256"
79
+
80
+ - name: Get Changelog
81
+ if: env.RELEASE_EXISTS == 'no'
82
+ run: |
83
+ CHANGELOG_ENTRY=$(node .github/scripts/get-changelog.js ${{ env.VERSION }})
84
+ # Properly handle multiline output in GitHub Actions
85
+ EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
86
+ echo "CHANGELOG_ENTRY<<$EOF" >> $GITHUB_ENV
87
+ echo "$CHANGELOG_ENTRY" >> $GITHUB_ENV
88
+ echo "$EOF" >> $GITHUB_ENV
89
+
90
+ - name: Release
91
+ if: env.RELEASE_EXISTS == 'no'
92
+ uses: softprops/action-gh-release@v2
93
+ with:
94
+ files: |
95
+ ${{ env.VSIX_NAME }}
96
+ ${{ env.VSIX_NAME }}.sha256
97
+ name: ${{ env.VERSION }}
98
+ tag_name: ${{ env.VERSION }}
99
+ body: |
100
+ Release ${{ env.VERSION }}
101
+
102
+ ## What's Changed
103
+ ${{ env.CHANGELOG_ENTRY }}
104
+
105
+ ## Installation
106
+ 1. [Download the .vsix file](${{ github.server_url }}/${{ github.repository }}/releases/download/${{ env.VERSION }}/${{ env.VSIX_NAME }})
107
+ 2. In your editor, open the Command Palette (<kbd>Meta</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd>)
108
+ 3. Type `Install from VSIX` and select the downloaded file
109
+
110
+ ## Checksum (SHA-256)
111
+ ```
112
+ ${{ env.CHECKSUM }}
113
+ ```
114
+
15
115
  - name: Publish to Open VSX Registry
116
+ if: env.PUBLISH_OPENVSX == 'yes'
16
117
  uses: HaaLeo/publish-vscode-extension@v2
17
118
  with:
119
+ extensionFile: ${{ env.VSIX_NAME }}
18
120
  pat: ${{ secrets.TOKEN_OPENVSX }}
19
121
  skipDuplicate: true
20
- if: env.PUBLISH_OPENVSX == 'yes'
122
+
21
123
  - name: Publish to Visual Studio Code Marketplace
124
+ if: env.PUBLISH_VSCODE == 'yes'
22
125
  uses: HaaLeo/publish-vscode-extension@v2
23
126
  with:
127
+ extensionFile: ${{ env.VSIX_NAME }}
24
128
  pat: ${{ secrets.TOKEN_VSCODE }}
25
129
  registryUrl: https://marketplace.visualstudio.com
26
130
  skipDuplicate: true
27
- if: env.PUBLISH_VSCODE == 'yes'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@daiyam/artifact-vsx-ts",
3
- "version": "0.6.1",
3
+ "version": "0.7.1",
4
4
  "description": "The configuration to create Visual Studio extensions and publish them on Visual Studio Marketplace and Open VSX Registry.",
5
5
  "author": {
6
6
  "name": "Baptiste Augrain",
@@ -31,5 +31,5 @@
31
31
  "project-template",
32
32
  "scaffold"
33
33
  ],
34
- "gitHead": "65f13222eb436d78dda6eb76972a004dc9c29dc3"
34
+ "gitHead": "1bdec477b3462d1abe61eda488707e53094fa925"
35
35
  }