Skip to content

Commit

Permalink
Created a github action to auto-build the library.
Browse files Browse the repository at this point in the history
Also fixed a test error and two warnings.
  • Loading branch information
ILOVEPIE committed Feb 12, 2024
1 parent 28409ae commit 2853ce9
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name-template: "v$RESOLVED_VERSION"
tag-template: "v$RESOLVED_VERSION"
tag-template: "$RESOLVED_VERSION"
categories:
- title: "🚀 Features"
labels:
Expand Down
97 changes: 97 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Build

on:
push:
branches:
- master
- stable

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/[email protected]

- name: Set up Node.js
uses: actions/[email protected]
with:
node-version: '21'

- name: Set up Java
uses: actions/[email protected]
with:
java-version: '21'

- name: Get next version
uses: reecetech/[email protected]
id: version
with:
scheme: semver
release_branch: stable
increment: patch

- name: Tag Commit
if: github.ref == 'refs/heads/stable'
uses: CrabMatrix/[email protected]
with:
tag: ${{ steps.version.outputs.version }}
repo-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Build package
run: |
echo "Building package"
make pkg
- name: Update package version
run: |
echo "Updating package version to ${{ steps.version.outputs.version }}"
sed -i "s/\"version\": \".*\"/\"version\": \"${{ steps.version.outputs.version }}\"/" temp_files/sabre/package.json
- name: Publish package
run: |
echo "Publishing package"
pushd temp_files/sabre && npm publish && popd
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

- name: Create release
if: github.ref == 'refs/heads/stable'
id: create_release
uses: release-drafter/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
config-file: .github/release-drafter.yml
tag: ${{ steps.version.outputs.version }}
name: ${{ steps.version.outputs.version }}
version: ${{ steps.version.outputs.version }}

- name: Zip Release
if: github.ref == 'refs/heads/stable'
run: zip -r -9 SABRE,js-${{ steps.version.outputs.version }}.zip ./bin ./debugbin ./LICENSE.md

- name: Upload Release
if: github.ref == 'refs/heads/stable'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./SABRE,js-${{ steps.version.outputs.version }}.zip
asset_name: SABRE,js-${{ steps.version.outputs.version }}.zip
asset_content_type: application/zip

- name: Publish Release
if: github.ref == 'refs/heads/stable'
uses: eregon/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ steps.create_release.outputs.id }}





15 changes: 0 additions & 15 deletions .github/workflows/release-draft.yml

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sabre-js/sabre",
"version": "0.2.0-git",
"version": "git",
"description": "A gpu accelerated ecmascript renderer for Advanced Substation Alpha (ASS) subtitles. Renders .ass and .ssa files over video in the browser.",
"main": "dist/sabre.min.js",
"types": "types/sabre.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/parser.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
global = globalThis;
require('../global-constants.js')
require('../util.js')
require('../global-constants.js')
require('../color.js');
require('../style.js');
require('../style-override.js');
Expand Down
8 changes: 4 additions & 4 deletions src/font-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@
* @private
* @enum {number}
*/
const platforms = Object.freeze({
const platforms = {
UNICODE: 0,
APPLE: 1,
MICROSOFT: 3
});
};

/**
* An enum of name types.
* @private
* @enum {number}
*/
const nameTypes = Object.freeze({
const nameTypes = {
COPYRIGHT: 0,
FONT_FAMILY: 1,
FONT_SUBFAMILY: 2,
Expand All @@ -33,7 +33,7 @@ const nameTypes = Object.freeze({
VERSION_STRING: 5,
PS_NAME: 6,
TRADEMARK: 7
});
};

const font_server_prototype = Object.create(Object, {
_fonts: {
Expand Down

0 comments on commit 2853ce9

Please sign in to comment.