Skip to content

Commit 0013cc9

Browse files
committed
Update release asset naming
1 parent e98f015 commit 0013cc9

File tree

3 files changed

+57
-6
lines changed

3 files changed

+57
-6
lines changed

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ jobs:
9595
9696
TAG=${{ needs.version-and-tag.outputs.tag }}
9797
if [[ "$TAG" =~ -alpha$ ]]; then
98-
FILE_NAME="${APP_NAME}-${VERSION}-alpha-glib2.28-linux-${{ matrix.arch }}-node${NODE_MAJOR}"
98+
FILE_NAME="${APP_NAME}-${VERSION}-alpha-linuxglib2.28-${{ matrix.arch }}-node${NODE_MAJOR}"
9999
elif [[ "$TAG" =~ -beta$ ]]; then
100-
FILE_NAME="${APP_NAME}-${VERSION}-beta-glib2.28-linux-${{ matrix.arch }}-node${NODE_MAJOR}"
100+
FILE_NAME="${APP_NAME}-${VERSION}-beta-linuxglib2.28-${{ matrix.arch }}-node${NODE_MAJOR}"
101101
else
102-
FILE_NAME="${APP_NAME}-${VERSION}-glib2.28-linux-${{ matrix.arch }}-node${NODE_MAJOR}"
102+
FILE_NAME="${APP_NAME}-${VERSION}-linuxglib2.28-${{ matrix.arch }}-node${NODE_MAJOR}"
103103
fi
104104
105105
ASSET_NAME=$(echo "$FILE_NAME" | tr '[:upper:]' '[:lower:]')

tools/generate-release-manifest.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ function fetchReleases(): GHRelease[] {
7171
});
7272
}
7373

74-
function parseTarget(filename: string): { platform: string; arch: string; nodejs?: string } | null {
74+
export function parseTarget(filename: string): { platform: string; arch: string; nodejs?: string } | null {
7575
// eslint-disable-next-line security/detect-unsafe-regex
76-
const match = filename.match(/(darwin|linux|win32)-(x64|arm64)(?:-node(\d+))?/);
77-
return match ? { platform: match[1], arch: match[2], nodejs: match[3] } : null;
76+
const match = filename.match(/^cloudformation-languageserver-(.*)-(.*)-(x64|arm64)(?:-node(\d+))?\.zip$/);
77+
return match ? { platform: match[2], arch: match[3], nodejs: match[4] } : null;
7878
}
7979

8080
function generateManifest() {

tst/unit/tools/GenerateReleaseManifest.test.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { rcompare } from 'semver';
22
import { describe, it, expect } from 'vitest';
3+
import { parseTarget } from '../../../tools/generate-release-manifest';
34

45
describe('Generate Release Manifest', () => {
56
describe('semver version sorting within environments', () => {
@@ -29,4 +30,54 @@ describe('Generate Release Manifest', () => {
2930
expect(sorted).toEqual(['v1.2.0', 'v1.1.0', 'v1.0.0']);
3031
});
3132
});
33+
34+
describe('parseTarget', () => {
35+
it('should parse linux with glib postfix', () => {
36+
expect(parseTarget('cloudformation-languageserver-1.2.0-alpha-linuxglib2.28-x64-node18.zip')).toEqual({
37+
platform: 'linuxglib2.28',
38+
arch: 'x64',
39+
nodejs: '18',
40+
});
41+
});
42+
43+
it('should parse linux without postfix', () => {
44+
expect(parseTarget('cloudformation-languageserver-1.2.0-alpha-linux-arm64-node22.zip')).toEqual({
45+
platform: 'linux',
46+
arch: 'arm64',
47+
nodejs: '22',
48+
});
49+
});
50+
51+
it('should parse darwin', () => {
52+
expect(parseTarget('cloudformation-languageserver-1.2.0-alpha-darwin-arm64-node22.zip')).toEqual({
53+
platform: 'darwin',
54+
arch: 'arm64',
55+
nodejs: '22',
56+
});
57+
});
58+
59+
it('should parse win32', () => {
60+
expect(parseTarget('cloudformation-languageserver-1.2.0-alpha-win32-x64-node22.zip')).toEqual({
61+
platform: 'win32',
62+
arch: 'x64',
63+
nodejs: '22',
64+
});
65+
});
66+
67+
it('should parse without nodejs version', () => {
68+
expect(parseTarget('cloudformation-languageserver-1.2.0-linux-x64.zip')).toEqual({
69+
platform: 'linux',
70+
arch: 'x64',
71+
nodejs: undefined,
72+
});
73+
});
74+
75+
it('should return null for non-zip files', () => {
76+
expect(parseTarget('cloudformation-languageserver-1.2.0-linux-x64.tar.gz')).toBeNull();
77+
});
78+
79+
it('should return null for invalid architecture', () => {
80+
expect(parseTarget('cloudformation-languageserver-1.2.0-linux-i386.zip')).toBeNull();
81+
});
82+
});
3283
});

0 commit comments

Comments
 (0)