Skip to content

Commit

Permalink
Merge pull request #2 from NDLA-H5P/feature/bump-library-action
Browse files Browse the repository at this point in the history
  • Loading branch information
boyum authored Apr 20, 2022
2 parents 74b6ae1 + 36da2fc commit 0e4e280
Show file tree
Hide file tree
Showing 8 changed files with 135 additions and 4 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Node.js CI

on:
- push
- workflow_dispatch

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Node.js dependencies
uses: bahmutov/npm-install@v1

- name: Build
run: npm run build

validate:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Node.js dependencies
uses: bahmutov/npm-install@v1

- name: Lint
run: npm run lint
40 changes: 40 additions & 0 deletions .github/workflows/bump-library.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
on: [issue_comment]

jobs:
bump-library:
name: Bump libary version
if: github.event.comment.body == '/bump major' || github.event.comment.body == '/bump minor' || github.event.comment.body == '/bump patch'

runs-on: ubuntu-latest

steps:
- name: "Check if user has write access"
uses: "lannonbr/[email protected]"
with:
permission: "write"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: React to comment
uses: dkershner6/reaction-action@v1 # https://github.com/marketplace/actions/comment-reaction
with:
token: ${{ secrets.GITHUB_TOKEN }}
reaction: "hooray" # +1 | -1 | laugh | confused | heart | hooray | rocket | eyes

- name: Bump major version
if: github.event.comment.body == '/bump major'
uses: boyum/bump-h5p-version@latest
with:
type: major

- name: Bump minor version
if: github.event.comment.body == '/bump minor'
uses: boyum/bump-h5p-version@latest
with:
type: minor

- name: Bump patch boyum/bump-h5p-version
if: github.event.comment.body == '/bump patch'
uses: boyum/bump-h5p-version@latest
with:
type: patch
20 changes: 20 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Pack and release content type

on: [push, workflow_dispatch]

jobs:
pack-and-release:
runs-on: ubuntu-latest
name: Pack and release
steps:
- uses: actions/checkout@v2
- uses: boyum/[email protected]
id: release-h5p
- uses: "marvinpinto/action-automatic-releases@latest" # https://github.com/marvinpinto/actions/tree/master/packages/automatic-releases
if: ${{ github.ref == 'refs/heads/main' }}
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: ${{steps.release-h5p.outputs.version}}
prerelease: false
files: |
${{steps.release-h5p.outputs.filePath}}
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
h5p-editor-uuid.js
h5p-editor-uuid.js.map
2 changes: 1 addition & 1 deletion h5p-editor-uuid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class UUIDWidget extends H5PWidget<H5PFieldText> implements IH5PWidget {
const isTextField = field.type === "text";
if (!isTextField) {
console.warn(
`The field \`${field.name}\` has the widget \`uuid\` set, but is of type \`${field.type}\`, not \`text\``
`The field \`${field.name}\` has the widget \`uuid\` set, but is of type \`${field.type}\`, not \`text\``,
);
}

Expand Down
34 changes: 34 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"main": "h5p-editor-uuid.js",
"scripts": {
"start": "vite build --mode=development --watch --minify=false",
"build": "tsc --noEmit && vite build"
"build": "tsc --noEmit && vite build",
"lint": "prettier .",
"lint:fix": "prettier . --write"
},
"repository": {
"type": "git",
Expand All @@ -21,9 +23,12 @@
"devDependencies": {
"@tsconfig/strictest": "^1.0.0",
"h5p-types": "github:boyum/h5p-types",
"prettier": "^2.6.2",
"prettier-config": "github:boyum/prettier-config",
"vite": "^2.8.6"
},
"dependencies": {
"h5p-utils": "github:boyum/h5p-utils"
}
},
"prettier": "prettier-config"
}
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { OutputAsset, OutputChunk } from "rollup";
import { defineConfig, PluginOption } from "vite";

const isOutputChunk = (
chunkOrAsset: OutputChunk | OutputAsset
chunkOrAsset: OutputChunk | OutputAsset,
): chunkOrAsset is OutputChunk => {
return chunkOrAsset["code"] != null;
};
Expand Down

0 comments on commit 0e4e280

Please sign in to comment.