Skip to content

Commit 2240fce

Browse files
committed
Created a github action to auto-build the library.
Also fixed a test error and two warnings.
1 parent 28409ae commit 2240fce

File tree

6 files changed

+104
-22
lines changed

6 files changed

+104
-22
lines changed

.github/release-drafter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name-template: "v$RESOLVED_VERSION"
2-
tag-template: "v$RESOLVED_VERSION"
2+
tag-template: "$RESOLVED_VERSION"
33
categories:
44
- title: "🚀 Features"
55
labels:

.github/workflows/build.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- stable
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4.1.1
16+
17+
- name: Set up Node.js
18+
uses: actions/setup-node@v4.0.2
19+
with:
20+
node-version: '21'
21+
22+
- name: Set up Java
23+
uses: actions/setup-java@v4.0.0
24+
with:
25+
java-version: '21'
26+
27+
- name: Get next version
28+
uses: reecetech/version-increment@2023.10.2
29+
id: version
30+
with:
31+
scheme: semver
32+
release_branch: stable
33+
increment: patch
34+
35+
- name: Tag Commit
36+
if: github.ref == 'refs/heads/stable'
37+
uses: CrabMatrix/github-tagger@v1.0.16
38+
with:
39+
tag: ${{ steps.version.outputs.version }}
40+
repo-token: "${{ secrets.GITHUB_TOKEN }}"
41+
42+
- name: Build package
43+
run: |
44+
echo "Building package"
45+
make pkg
46+
47+
- name: Update package version
48+
run: |
49+
echo "Updating package version to ${{ steps.version.outputs.version }}"
50+
sed -i "s/\"version\": \".*\"/\"version\": \"${{ steps.version.outputs.version }}\"/" temp_files/sabre/package.json
51+
52+
- name: Publish package
53+
run: |
54+
echo "Publishing package"
55+
pushd temp_files/sabre && npm publish && popd
56+
env:
57+
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
58+
59+
- name: Create release
60+
if: github.ref == 'refs/heads/stable'
61+
id: create_release
62+
uses: release-drafter/release-drafter@v6.0.0
63+
env:
64+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65+
with:
66+
config-file: .github/release-drafter.yml
67+
tag: ${{ steps.version.outputs.version }}
68+
name: ${{ steps.version.outputs.version }}
69+
version: ${{ steps.version.outputs.version })
70+
71+
- name: Zip Release
72+
if: github.ref == 'refs/heads/stable'
73+
run: zip -r -9 SABRE,js-${{ steps.version.outputs.version }}.zip ./bin ./debugbin ./LICENSE.md
74+
75+
- name: Upload Release
76+
if: github.ref == 'refs/heads/stable'
77+
uses: actions/upload-release-asset@v1
78+
env:
79+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80+
with:
81+
upload_url: ${{ steps.create_release.outputs.upload_url }}
82+
asset_path: ./SABRE,js-${{ steps.version.outputs.version }}.zip
83+
asset_name: SABRE,js-${{ steps.version.outputs.version }}.zip
84+
asset_content_type: application/zip
85+
86+
- name: Publish Release
87+
if: github.ref == 'refs/heads/stable'
88+
uses: eregon/publish-release@v1.0.5
89+
env:
90+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91+
with:
92+
release_id: ${{ steps.create_release.outputs.id }}
93+
94+
95+
96+
97+

.github/workflows/release-draft.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sabre-js/sabre",
3-
"version": "0.2.0-git",
3+
"version": "git",
44
"description": "A gpu accelerated ecmascript renderer for Advanced Substation Alpha (ASS) subtitles. Renders .ass and .ssa files over video in the browser.",
55
"main": "dist/sabre.min.js",
66
"types": "types/sabre.d.ts",

src/__tests__/parser.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
global = globalThis;
2-
require('../global-constants.js')
32
require('../util.js')
3+
require('../global-constants.js')
44
require('../color.js');
55
require('../style.js');
66
require('../style-override.js');

src/font-server.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@
1313
* @private
1414
* @enum {number}
1515
*/
16-
const platforms = Object.freeze({
16+
const platforms = {
1717
UNICODE: 0,
1818
APPLE: 1,
1919
MICROSOFT: 3
20-
});
20+
};
2121

2222
/**
2323
* An enum of name types.
2424
* @private
2525
* @enum {number}
2626
*/
27-
const nameTypes = Object.freeze({
27+
const nameTypes = {
2828
COPYRIGHT: 0,
2929
FONT_FAMILY: 1,
3030
FONT_SUBFAMILY: 2,
@@ -33,7 +33,7 @@ const nameTypes = Object.freeze({
3333
VERSION_STRING: 5,
3434
PS_NAME: 6,
3535
TRADEMARK: 7
36-
});
36+
};
3737

3838
const font_server_prototype = Object.create(Object, {
3939
_fonts: {

0 commit comments

Comments
 (0)