Skip to content

Commit

Permalink
fix: workflow (#262)
Browse files Browse the repository at this point in the history
* fix: gh action

* chore: version bump
  • Loading branch information
samuelOsborne authored Nov 4, 2024
1 parent 1cfd3fa commit c0b4f8d
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 89 deletions.
57 changes: 25 additions & 32 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,45 +11,41 @@ jobs:
permissions:
contents: read

strategy:
matrix:
node-version: [14.x]

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache NPM
uses: actions/cache@v2
uses: actions/cache@v4
env:
cache-name: cache-npm
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
- name: Setup Node.js 20
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
node-version: 20
registry-url: https://registry.npmjs.org/
- name: Install dependencies
run: yarn
env:
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_TOKEN }}
- name: Build project
run: yarn build
- name: Serve example app
continue-on-error: false
run: yarn run serve
env:
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_TOKEN }}
- name: Build project and run tests
continue-on-error: false
run: yarn run run-tests
env:
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_TOKEN }}
# - name: Serve example app
# continue-on-error: false
# run: yarn run serve
# env:
# NODE_AUTH_TOKEN: ${{ secrets.NPMJS_TOKEN }}
# - name: Build project and run tests
# continue-on-error: false
# run: yarn run run-tests
# env:
# NODE_AUTH_TOKEN: ${{ secrets.NPMJS_TOKEN }}

release-npm:
needs: build
Expand All @@ -61,15 +57,11 @@ jobs:
id-token: write # Required for provenance
packages: write # Required for publishing

strategy:
matrix:
node-version: [14.x]

steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
node-version: 20
registry-url: https://registry.npmjs.org/
- run: yarn install
env:
Expand All @@ -95,15 +87,16 @@ jobs:
name: Release gpr
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x]
permissions:
contents: read
id-token: write # Required for provenance
packages: write # Required for publishing

steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
node-version: 20
registry-url: https://npm.pkg.github.com/
- run: yarn install
env:
Expand Down
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lottiefiles/lottie-player",
"version": "2.0.11",
"version": "2.0.12",
"description": "Lottie animation and Telegram Sticker player web components.",
"main": "dist/lottie-player.js",
"module": "dist/lottie-player.esm.js",
Expand All @@ -11,9 +11,7 @@
"author": "Jawish Hameed <[email protected]>",
"license": "MIT",
"scripts": {
"prestart": "node -p \"'export const LOTTIE_PLAYER_VERSION = ' + JSON.stringify(require('./package.json').version) + '; \\n' + 'export const LOTTIE_WEB_VERSION = ' + JSON.stringify(require('./package.json').dependencies['lottie-web']) + ';'\" > src/versions.ts",
"start": "npm run cleanup && rollup -c --watch",
"prebuild": "node -p \"'export const LOTTIE_PLAYER_VERSION = ' + JSON.stringify(require('./package.json').version) + '; \\n' + 'export const LOTTIE_WEB_VERSION = ' + JSON.stringify(require('./package.json').dependencies['lottie-web']) + ';'\" > src/versions.ts",
"build": "npm run cleanup && npm run build-lottie && npm run build-tgs",
"build-with-coverage": "npm run cleanup && CODE_COVERAGE=true npm run build-lottie && CODE_COVERAGE=true npm run build-tgs",
"build-lottie": "rollup -c ",
Expand Down Expand Up @@ -46,9 +44,9 @@
"@commitlint/config-conventional": "^16.0.0",
"@cypress/code-coverage": "^3.9.12",
"@istanbuljs/nyc-config-typescript": "^1.0.2",
"@lottiefiles/eslint-plugin": "^3.0.0",
"@rollup/plugin-babel": "^5.1.0",
"@rollup/plugin-commonjs": "^21.0.1",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^13.1.3",
"@semantic-release/changelog": "^6.0.1",
"@semantic-release/commit-analyzer": "^9.0.2",
Expand Down
42 changes: 22 additions & 20 deletions rollup-tgs.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import resolve from "@rollup/plugin-node-resolve";
import serve from "rollup-plugin-serve";
import { terser } from "rollup-plugin-terser";
import typescript2 from "rollup-plugin-typescript2";
import json from "@rollup/plugin-json";

const production = !process.env.ROLLUP_WATCH;
const extensions = [".js", ".jsx", ".ts", ".tsx", ".mjs"];
Expand Down Expand Up @@ -43,29 +44,30 @@ export default {
exclude: ["./node_modules/@babel/**/*", "./node_modules/core-js/**/*"],
}),
!production &&
copy({
targets: [
{ src: "./src/index.html", dest: outputDir },
{ src: "./src/sticker.tgs", dest: outputDir },
{
src: "./node_modules/@webcomponents/webcomponentsjs/bundles/",
dest: outputDir,
},
{
src: "./node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js",
dest: outputDir,
},
],
}),
copy({
targets: [
{ src: "./src/index.html", dest: outputDir },
{ src: "./src/sticker.tgs", dest: outputDir },
{
src: "./node_modules/@webcomponents/webcomponentsjs/bundles/",
dest: outputDir,
},
{
src: "./node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js",
dest: outputDir,
},
],
}),
filesize(),
!production &&
serve({
contentBase: [outputDir],
open: true,
host: "localhost",
port: 10001,
}),
serve({
contentBase: [outputDir],
open: true,
host: "localhost",
port: 10001,
}),

production && terser(),
json(),
],
};
58 changes: 30 additions & 28 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import resolve from "@rollup/plugin-node-resolve";
import serve from "rollup-plugin-serve";
import { terser } from "rollup-plugin-terser";
import typescript2 from "rollup-plugin-typescript2";
import json from "@rollup/plugin-json";

const production = !process.env.ROLLUP_WATCH;
const extensions = [".js", ".jsx", ".ts", ".tsx", ".mjs"];
Expand Down Expand Up @@ -44,37 +45,38 @@ export default {
exclude: ["./node_modules/@babel/**/*", "./node_modules/core-js/**/*"],
}),
!production &&
copy({
targets: [
{ src: "./src/index.html", dest: outputDir },
{ src: "./src/worker.js", dest: outputDir },
{ src: "./src/sticker.tgs", dest: outputDir },
{
src: "./node_modules/@webcomponents/webcomponentsjs/bundles/",
dest: outputDir,
},
{
src: "./node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js",
dest: outputDir,
},
],
}),
copy({
targets: [
{ src: "./src/index.html", dest: outputDir },
{ src: "./src/worker.js", dest: outputDir },
{ src: "./src/sticker.tgs", dest: outputDir },
{
src: "./node_modules/@webcomponents/webcomponentsjs/bundles/",
dest: outputDir,
},
{
src: "./node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js",
dest: outputDir,
},
],
}),
filesize(),
!production &&
serve({
contentBase: [outputDir],
open: true,
host: "localhost",
port: 10001,
}),
serve({
contentBase: [outputDir],
open: true,
host: "localhost",
port: 10001,
}),

production &&
// uglify({ mangle: false }),
terser({
compress: {},
mangle: {
reserved: ["_workerSelf"],
},
}),
// uglify({ mangle: false }),
terser({
compress: {},
mangle: {
reserved: ["_workerSelf"],
},
}),
json(),
],
};
7 changes: 4 additions & 3 deletions src/lottie-player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { TemplateResult } from "lit/html.js";
import * as lottie from "lottie-web/build/player/lottie";

import styles from "./lottie-player.styles";
import { LOTTIE_PLAYER_VERSION, LOTTIE_WEB_VERSION } from "./versions";
import { version } from "../package.json";
import { dependencies } from "../package.json";

// import ResizeObserver from "resize-observer-polyfill";

Expand Down Expand Up @@ -316,8 +317,8 @@ export class LottiePlayer extends LitElement {
*/
public getVersions(): Versions {
return {
lottieWebVersion: LOTTIE_WEB_VERSION,
lottiePlayerVersion: LOTTIE_PLAYER_VERSION,
lottieWebVersion: dependencies["lottie-web"],
lottiePlayerVersion: version,
};
}

Expand Down
2 changes: 0 additions & 2 deletions src/versions.ts

This file was deleted.

0 comments on commit c0b4f8d

Please sign in to comment.