mirror of
https://github.com/kalkih/mini-graph-card.git
synced 2025-12-20 00:35:56 +01:00
chore(ci): Add Devcontainer and github action for auto-release management (#537)
* Add devcontainer * Add github-actions and semantic-release
This commit is contained in:
9
.devcontainer/configuration.yaml
Normal file
9
.devcontainer/configuration.yaml
Normal file
@@ -0,0 +1,9 @@
|
||||
lovelace:
|
||||
mode: yaml
|
||||
resources:
|
||||
- url: http://127.0.0.1:5000/mini-graph-card-bundle.js
|
||||
type: module
|
||||
|
||||
default_config:
|
||||
|
||||
demo:
|
||||
35
.devcontainer/devcontainer.json
Normal file
35
.devcontainer/devcontainer.json
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"name": "Mini Graph Card Development",
|
||||
"image": "ghcr.io/ludeeus/devcontainer/generic:latest",
|
||||
"context": "..",
|
||||
// "remoteUser": "vscode",
|
||||
"appPort": [
|
||||
"8123:8123",
|
||||
"5000:5000",
|
||||
],
|
||||
"postCreateCommand": "npm install && container install",
|
||||
"extensions": [
|
||||
"github.vscode-pull-request-github",
|
||||
"eamodio.gitlens",
|
||||
"dbaeumer.vscode-eslint",
|
||||
"redhat.vscode-yaml",
|
||||
"yzhang.markdown-all-in-one",
|
||||
],
|
||||
"settings": {
|
||||
"files.eol": "\n",
|
||||
"editor.tabSize": 2,
|
||||
"terminal.integrated.shell.linux": "/bin/bash",
|
||||
"editor.formatOnPaste": false,
|
||||
"editor.formatOnSave": true,
|
||||
"editor.formatOnType": true,
|
||||
"files.trimTrailingWhitespace": true,
|
||||
"markdown.extension.toc.githubCompatibility": true,
|
||||
"files.watcherExclude": {
|
||||
"**/.git/objects/**": true,
|
||||
"**/.git/subtree-cache/**": true,
|
||||
"**/node_modules/**": true,
|
||||
"**/.hg/store/**": true,
|
||||
"**/.rpt2_cache/**": true
|
||||
}
|
||||
}
|
||||
}
|
||||
6
.devcontainer/ui-lovelace.yaml
Normal file
6
.devcontainer/ui-lovelace.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
views:
|
||||
- title: Main
|
||||
cards:
|
||||
- type: custom:mini-graph-card
|
||||
entities:
|
||||
- sensor.outside_humidity
|
||||
11
.github/dependabot.yml
vendored
Normal file
11
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "npm"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
open-pull-requests-limit: 0
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
60
.github/workflows/ci.yml
vendored
Normal file
60
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- "*"
|
||||
push:
|
||||
branches:
|
||||
- "*"
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
# push or fork
|
||||
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js 12.x
|
||||
uses: actions/setup-node@v2.1.4
|
||||
with:
|
||||
node-version: 12.x
|
||||
- name: Cache Node.js modules
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
|
||||
key: ${{ runner.OS }}-node-12.x-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.OS }}-node-12.x
|
||||
${{ runner.OS }}-
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
- name: Lint the code
|
||||
run: npm run lint --if-present
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [10.x, 12.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v2.1.4
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: Cache Node.js modules
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
|
||||
key: ${{ runner.OS }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.OS }}-node-${{ matrix.node-version }}
|
||||
${{ runner.OS }}-
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
- name: Build the project
|
||||
run: npm run build --if-present
|
||||
34
.github/workflows/release.yml
vendored
Normal file
34
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
name: Release
|
||||
|
||||
on: workflow_dispatch
|
||||
|
||||
jobs:
|
||||
release-bundle:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
outputs:
|
||||
new_release_published: ${{ steps.semantic.outputs.new_release_published }}
|
||||
new_release_version: ${{ steps.semantic.outputs.new_release_version }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js 12.x
|
||||
uses: actions/setup-node@v2.1.4
|
||||
with:
|
||||
node-version: 12.x
|
||||
- name: Cache Node.js modules
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
|
||||
key: ${{ runner.OS }}-node-12.x-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.OS }}-node-12.x
|
||||
${{ runner.OS }}-
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
- name: Build
|
||||
run: npm run build
|
||||
- name: Release
|
||||
run: npx semantic-release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,5 +1,3 @@
|
||||
/node_modules/
|
||||
/dist/
|
||||
package-lock.json
|
||||
.vscode/
|
||||
.DS_Store
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "10.15.0"
|
||||
- "8.12.0"
|
||||
script:
|
||||
- npm run lint
|
||||
- npm run rollup
|
||||
- npm run babel
|
||||
16
.vscode/launch.json
vendored
Normal file
16
.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "chrome",
|
||||
"request": "launch",
|
||||
"name": "Launch Chrome against localhost",
|
||||
"url": "http://localhost:8123",
|
||||
"webRoot": "${workspaceFolder}/dist",
|
||||
"sourceMaps": true
|
||||
}
|
||||
]
|
||||
}
|
||||
11082
package-lock.json
generated
Normal file
11082
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -38,8 +38,9 @@
|
||||
"eslint": "^5.3.0",
|
||||
"eslint-config-airbnb-base": "^13.1.0",
|
||||
"eslint-plugin-import": "^2.17.2",
|
||||
"rollup": "^0.66.6",
|
||||
"rollup-plugin-node-resolve": "^3.4.0"
|
||||
"rollup": "^2.33.1",
|
||||
"rollup-plugin-node-resolve": "^3.4.0",
|
||||
"rollup-plugin-serve": "^1.1.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "npm run lint && npm run rollup && npm run babel",
|
||||
|
||||
19
release.config.js
Normal file
19
release.config.js
Normal file
@@ -0,0 +1,19 @@
|
||||
module.exports = {
|
||||
"plugins": [
|
||||
"@semantic-release/commit-analyzer",
|
||||
"@semantic-release/release-notes-generator",
|
||||
"@semantic-release/changelog",
|
||||
["@semantic-release/npm", {
|
||||
"npmPublish": false,
|
||||
}],
|
||||
["@semantic-release/github", {
|
||||
"assets": "dist/*.js"
|
||||
}],
|
||||
"@semantic-release/git"
|
||||
],
|
||||
"preset": "angular",
|
||||
"branches": [
|
||||
"master",
|
||||
{ "name": "dev", "prerelease": true },
|
||||
]
|
||||
}
|
||||
@@ -1,5 +1,17 @@
|
||||
import resolve from 'rollup-plugin-node-resolve';
|
||||
import json from '@rollup/plugin-json';
|
||||
import serve from 'rollup-plugin-serve';
|
||||
|
||||
const dev = process.env.ROLLUP_WATCH;
|
||||
const serveopts = {
|
||||
contentBase: ['./dist'],
|
||||
host: '0.0.0.0',
|
||||
port: 5000,
|
||||
allowCrossOrigin: true,
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
},
|
||||
};
|
||||
|
||||
export default {
|
||||
input: 'src/main.js',
|
||||
@@ -7,6 +19,7 @@ export default {
|
||||
file: 'dist/mini-graph-card-bundle.js',
|
||||
format: 'umd',
|
||||
name: 'MiniGraphCard',
|
||||
sourcemap: dev ? true : false,
|
||||
},
|
||||
plugins: [
|
||||
json({
|
||||
@@ -14,5 +27,6 @@ export default {
|
||||
preferConst: true,
|
||||
}),
|
||||
resolve(),
|
||||
dev && serve(serveopts),
|
||||
],
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user