Compare commits

..
2 Commits
Author SHA1 Message Date
ari 0be03b1536 updating api routing 2022-05-16 15:38:13 -04:00
ari dc726ff184 consolidated 2022-05-16 12:58:39 -04:00
7 changed files with 50 additions and 60 deletions

No files matched your search

+36 -10
View File
@@ -9,9 +9,32 @@ on:
paths: paths:
- 'config.yaml' - 'config.yaml'
jobs: jobs:
metadata:
runs-on: ubuntu-latest
name: Metadata
outputs:
version: ${{ steps.version.outputs.VERSION }}
changlelog: ${{ steps.changlelog.outputs.CHANGELOG }}
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Get Version
id: version
shell: bash
run: |
echo ::set-output name=VERSION::$(cat config.yaml | sed -nr 's/version: (.*)/\1/p')
- name: Get Changelog
id: changlelog
shell: bash
run: |
echo ::set-output name=CHANGELOG::$(cat CHANGELOG.md)
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: ${{ matrix.arch }} name: Build & Publish ${{ matrix.arch }}
needs:
- metadata
strategy: strategy:
matrix: matrix:
arch: ["aarch64", "amd64", "armhf", "armv7", "i386"] arch: ["aarch64", "amd64", "armhf", "armv7", "i386"]
@@ -20,33 +43,36 @@ jobs:
- name: Check out repository - name: Check out repository
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Get Version
id: version
shell: bash
run: |
echo ::set-output name=VERSION::$(cat config.yaml | sed -nr 's/version: (.*)/\1/p')
- name: Login to DockerHub - name: Login to DockerHub
uses: docker/login-action@v2.0.0 uses: docker/login-action@v2.0.0
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: ${{ steps.version.outputs.VERSION }} / ${{ matrix.arch }} - name: Build & Push to Dockerhub - ${{ matrix.arch }} / ${{ needs.metadata.outputs.version }}
uses: home-assistant/builder@2022.03.1 uses: home-assistant/builder@2022.03.1
with: with:
args: | args: |
--${{ matrix.arch }} \ --${{ matrix.arch }} \
--target . --target .
- name: Publish Release ${{ steps.version.outputs.VERSION }} publish:
runs-on: ubuntu-latest
needs:
- metadata
- build
name: Publish Github Release
steps:
- name: Publish Release ${{ needs.metadata.outputs.version }}
uses: actions/github-script@v6 uses: actions/github-script@v6
env: env:
VERSION: ${{ steps.version.outputs.VERSION }} VERSION: ${{ needs.metadata.outputs.version }}
CHANGELOG: ${{ needs.metadata.outputs.changlelog }}
with: with:
script: | script: |
github.rest.repos.createRelease({ github.rest.repos.createRelease({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
tag_name: process.env.VERSION, tag_name: process.env.VERSION,
body: process.env.CHANGELOG,
}); });
+1 -38
View File
@@ -1,40 +1,3 @@
# Changelog -- [![GitHub version](https://badge.fury.io/gh/asosnovsky%2FShortumation.svg)](https://badge.fury.io/gh/asosnovsky%2FShortumation) # Changelog -- [![GitHub version](https://badge.fury.io/gh/asosnovsky%2FShortumation.svg)](https://badge.fury.io/gh/asosnovsky%2FShortumation)
## [0.1.2] - Docker Hub Images - Updated Api Routing
- Publishing images to docker hub is now stable
## [0.0.15] - Publish to dockerhub
- Publishing images to docker hub
## [0.0.14] - Using vanila ha yaml
- Supporing vanilla out of the box HA yaml as oppose to parsing them (no more $smType)
- Conditions have now a more a explicit node
## [0.0.13] - Better Styling with react-flow
- Fixed up styling (using react-flow)
- cleaned up some button styles
## [0.0.12] - Tags
- Added tag management system for automations
## [0.0.11] - Zoom
- Added lazy saving
## [0.0.10] - Zoom
- Introducing Zoom!
## [0.0.9] - First Working Version
- Instalable verion via github
- Initial POC done
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+2 -2
View File
@@ -25,11 +25,11 @@ def make_automation_router(automations: AutomationManager) -> APIRouter:
), ),
) )
@router.post("") @router.post("/item")
def upsert_auto(body: UpdateAutoRequest): def upsert_auto(body: UpdateAutoRequest):
automations.update(body.index, body.data) automations.update(body.index, body.data)
@router.delete("") @router.delete("/item")
def delete_auto(body: DeleteAutoRequest): def delete_auto(body: DeleteAutoRequest):
try: try:
automations.delete(body.index) automations.delete(body.index)
+1 -1
View File
@@ -1,5 +1,5 @@
name: Shortumation name: Shortumation
version: 0.1.3 version: 0.1.4
slug: shortumation slug: shortumation
image: asosnovsky/shortumation-{arch} image: asosnovsky/shortumation-{arch}
url: "https://github.com/asosnovsky/Shortumation" url: "https://github.com/asosnovsky/Shortumation"
+5 -5
View File
@@ -1,7 +1,7 @@
import { AutomationData } from "types/automations"; import { AutomationData } from "types/automations";
import { API } from "./base"; import { API } from "./base";
import { ListData, ListParams } from "./types"; import { ListData, ListParams } from "./types";
import { AUTOMTAION_LIST, AUTOMTAION_ROOT } from './paths'; import { AUTOMTAION_LIST, AUTOMTAION_ITEM } from './paths';
export const makeAutomationAPI = (api: API) => ({ export const makeAutomationAPI = (api: API) => ({
@@ -14,19 +14,19 @@ export const makeAutomationAPI = (api: API) => ({
}); });
return data; return data;
}, },
async update({index, auto}: {index: number, auto: AutomationData}) { async update({ index, auto }: { index: number, auto: AutomationData }) {
return await api.makeCall({ return await api.makeCall({
path: AUTOMTAION_ROOT, path: AUTOMTAION_ITEM,
data: { data: {
index, index,
data: auto data: auto
}, },
}) })
}, },
async remove({index}: {index: number}) { async remove({ index }: { index: number }) {
return await api.makeCall({ return await api.makeCall({
method: "DELETE", method: "DELETE",
path: AUTOMTAION_ROOT, path: AUTOMTAION_ITEM,
data: { data: {
index, index,
} }
+2 -2
View File
@@ -1,7 +1,7 @@
import { useRef } from 'react'; import { useRef } from 'react';
import { AutomationData } from 'types/automations'; import { AutomationData } from 'types/automations';
import { API } from './base'; import { API } from './base';
import { AUTOMTAION_LIST, AUTOMTAION_ROOT } from './paths'; import { AUTOMTAION_LIST, AUTOMTAION_ITEM } from './paths';
export const useMockAPI = ( export const useMockAPI = (
@@ -26,7 +26,7 @@ export const useMockAPI = (
})) }))
} as any } as any
} }
if (path === AUTOMTAION_ROOT) { if (path === AUTOMTAION_ITEM) {
if (method === 'POST') { if (method === 'POST') {
const { index, data: auto } = data as any; const { index, data: auto } = data as any;
if (index >= automationsRef.current.length) { if (index >= automationsRef.current.length) {
+3 -2
View File
@@ -1,4 +1,5 @@
export const AUTOMTAION_ROOT = '' as const; export const AUTOMTAION_ROOT = '/' as const;
export const AUTOMTAION_LIST = `${AUTOMTAION_ROOT}/list` as const; export const AUTOMTAION_LIST = `${AUTOMTAION_ROOT}list` as const;
export const AUTOMTAION_ITEM = `${AUTOMTAION_ROOT}item` as const;