chore(ci): Update CI with semantic-release

This commit is contained in:
Jérôme Wiedemann 2021-02-12 17:21:09 +00:00
parent 1010a09a77
commit 2d3d690b0f
10 changed files with 1532 additions and 155 deletions

View File

@ -1,3 +0,0 @@
FROM ludeeus/container:monster
RUN apk add jq

View File

@ -1,16 +1,12 @@
// See https://aka.ms/vscode-remote/devcontainer.json for format details.
{
"name": "Button Card Development",
"dockerFile": "Dockerfile",
"image": "ghcr.io/ludeeus/devcontainer/generic:latest",
"context": "..",
"remoteUser": "vscode",
"appPort": ["5000:5000", "9123:8123"],
"postCreateCommand": "yarn install",
"runArgs": [
"-v",
"${env:HOME}${env:USERPROFILE}/.ssh:/tmp/.ssh", // This is added so you can push from inside the container
"-v",
"${localWorkspaceFolder}/.devcontainer/www:/config/www"
],
"runArgs": ["-v", "${localWorkspaceFolder}/.devcontainer/www:/config/www"],
"extensions": [
"github.vscode-pull-request-github",
"eamodio.gitlens",

View File

@ -1,20 +0,0 @@
name: "Build"
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
name: Test build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Build
run: |
yarn install
npm run build

56
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,56 @@
name: CI
on:
pull_request:
branches:
- '*'
push:
branches:
- '*'
jobs:
lint:
runs-on: ubuntu-latest
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('**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-node-12.x
${{ runner.OS }}-
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Lint the code
run: npm run lint --if-present
build:
runs-on: ubuntu-latest
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('**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-node-${{ matrix.node-version }}
${{ runner.OS }}-
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build the project
run: npm run build --if-present

View File

@ -1,30 +1,33 @@
name: Release
on:
release:
types: [published]
on: workflow_dispatch
jobs:
release:
name: Prepare release
release-bundle:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev'
outputs:
new_release_published: ${{ steps.semantic.outputs.new_release_published }}
new_release_version: ${{ steps.semantic.outputs.new_release_version }}
steps:
- uses: actions/checkout@v1
# Build
- name: Build the file
run: |
cd /home/runner/work/button-card/button-card
yarn install
npm run build
# Upload build file to the releas as an asset.
- name: Upload zip to release
uses: svenstaro/upload-release-action@v1-release
- uses: actions/checkout@v2
- name: Use Node.js 12.x
uses: actions/setup-node@v2.1.4
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: /home/runner/work/button-card/button-card/dist/button-card.js
asset_name: button-card.js
tag: ${{ github.ref }}
overwrite: true
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('**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-node-12.x
${{ runner.OS }}-
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Release
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

1
.npmrc
View File

@ -1 +0,0 @@
git-tag-version=false

View File

@ -1,73 +0,0 @@
## 0.0.3
Custom state, label card and icon attribute
### New features :
- New setting for custom states
- Label card for organization https://github.com/kuuji/button-card/pull/23 by [jxwolstenholme](https://github.com/jxwolstenholme)
- Use icon attribute from entity if it exists https://github.com/kuuji/button-card/pull/21 by [emilp333](https://github.com/emilp333)
- Support for hex color in auto mode https://github.com/kuuji/button-card/pull/10 by [simo878](https://github.com/simo878)
#### Custom state example with input select entity
```yaml
- type: "custom:button-card"
entity: input_select.cube_mode
icon: mdi:cube
action: service
show_state: true
state:
- value: 'sleeping'
color: var(--disabled-text-color)
- value: 'media'
color: rgb(5, 147, 255)
- value: 'light'
color: rgb(189, 255, 5)
```
### Other
- Allow to show both state and name (and doesn't break the style)
- Support for unit of measurement
## 0.0.2
Custom service, blank card and custom_updater support
### New features :
- New action type `service`
- Service + data configuration
- Blank-card
- Support for custom_updater
![volume](examples/volume.png)
### Other
- Refactoring
- Linting
## 0.0.1
Initial release that supports versioning
### New features :
- Color on off state
- Default color on light (when color set to `auto` and detection fails)
- Background color card
- Boolean to show/hide state
- Automatic font color based on card color (for readability)
### Changed features :
- Automatic color mode for lights now has to be enabled via `color: auto`
- State display has to be enabled explicity via `show_state: true` and is not enabled by default when an icon is not set
### Other
- Lots of refactoring
- Versionning

View File

@ -35,8 +35,15 @@
"@rollup/plugin-commonjs": "^16.0.0",
"@rollup/plugin-json": "^4.0.2",
"@rollup/plugin-node-resolve": "^10.0.0",
"@semantic-release/changelog": "^5.0.1",
"@semantic-release/commit-analyzer": "^8.0.1",
"@semantic-release/exec": "^5.0.0",
"@semantic-release/git": "^9.0.0",
"@semantic-release/npm": "^7.0.10",
"@semantic-release/release-notes-generator": "^9.0.1",
"@typescript-eslint/eslint-plugin": "^4.6.1",
"@typescript-eslint/parser": "^4.6.1",
"conventional-changelog-conventionalcommits": "^4.5.0",
"eslint": "7.12.1",
"eslint-config-airbnb-base": "^14.1.0",
"eslint-config-prettier": "^6.15.0",
@ -50,6 +57,7 @@
"rollup-plugin-serve": "^1.1.0",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.29.0",
"semantic-release": "^17.3.8",
"ts-lit-plugin": "^1.1.10",
"typescript": "^4.0.5",
"typescript-styled-plugin": "^0.15.0"

42
release.config.js Normal file
View File

@ -0,0 +1,42 @@
/* eslint-disable no-template-curly-in-string */
module.exports = {
plugins: [
'@semantic-release/commit-analyzer',
[
'@semantic-release/release-notes-generator',
{
preset: 'conventionalcommits',
presetConfig: {
types: [
{ type: 'feat', section: 'Features' },
{ type: 'fix', section: 'Bug Fixes' },
{ type: 'doc', hidden: false, section: 'Documentation' },
{ type: 'docs', hidden: false, section: 'Documentation' },
{ type: 'chore', hidden: true, section: 'Chores' },
],
},
},
],
'@semantic-release/changelog',
[
'@semantic-release/npm',
{
npmPublish: false,
},
],
[
'@semantic-release/git',
{
assets: ['CHANGELOG.md', 'README.md', 'package.json', 'yarn.lock'],
},
],
[
'@semantic-release/github',
{
assets: 'dist/*.js',
},
],
],
preset: 'conventionalcommits',
branches: [{ name: 'master' }, { name: 'dev', channel: 'beta', prerelease: true }],
};

1425
yarn.lock

File diff suppressed because it is too large Load Diff