diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index f45f541..bb27699 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -9,44 +9,70 @@ on: paths: - 'config.yaml' jobs: - build: - runs-on: ubuntu-latest - name: Build & Publish - # strategy: - # matrix: - # arch: ["aarch64", "amd64", "armhf", "armv7", "i386"] + 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: + runs-on: ubuntu-latest + name: Build & Publish ${{ matrix.arch }} + needs: + - metadata + strategy: + matrix: + arch: ["aarch64", "amd64", "armhf", "armv7", "i386"] + + steps: + - name: Check out repository + uses: actions/checkout@v3 + - name: Login to DockerHub uses: docker/login-action@v2.0.0 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: ${{ steps.version.outputs.VERSION }} + - name: Build & Push to Dockerhub - ${{ matrix.arch }} / ${{ needs.metadata.outputs.version }} uses: home-assistant/builder@2022.03.1 with: args: | - --all \ + --${{ matrix.arch }} \ --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 env: - VERSION: ${{ steps.version.outputs.VERSION }} + VERSION: ${{ needs.metadata.outputs.version }} + CHANGELOG: ${{ needs.metadata.outputs.changlelog }} with: script: | github.rest.repos.createRelease({ owner: context.repo.owner, repo: context.repo.repo, tag_name: process.env.VERSION, + body: process.env.CHANGELOG, }); \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 47ff33c..b00e424 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,40 +1,3 @@ # Changelog -- [![GitHub version](https://badge.fury.io/gh/asosnovsky%2FShortumation.svg)](https://badge.fury.io/gh/asosnovsky%2FShortumation) -## [0.1.2] - Docker Hub Images - -- 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). +- Updated Api Routing \ No newline at end of file diff --git a/api/src/api/routes/automations.py b/api/src/api/routes/automations.py index 6b3d5db..6868c47 100644 --- a/api/src/api/routes/automations.py +++ b/api/src/api/routes/automations.py @@ -25,11 +25,11 @@ def make_automation_router(automations: AutomationManager) -> APIRouter: ), ) - @router.post("") + @router.post("/item") def upsert_auto(body: UpdateAutoRequest): automations.update(body.index, body.data) - @router.delete("") + @router.delete("/item") def delete_auto(body: DeleteAutoRequest): try: automations.delete(body.index) diff --git a/config.yaml b/config.yaml index 02291d3..d57175c 100644 --- a/config.yaml +++ b/config.yaml @@ -1,5 +1,5 @@ name: Shortumation -version: 0.1.3 +version: 0.1.4 slug: shortumation image: asosnovsky/shortumation-{arch} url: "https://github.com/asosnovsky/Shortumation" diff --git a/webapp/src/apiService/automations.ts b/webapp/src/apiService/automations.ts index 3a90bab..7d0ab10 100644 --- a/webapp/src/apiService/automations.ts +++ b/webapp/src/apiService/automations.ts @@ -1,7 +1,7 @@ import { AutomationData } from "types/automations"; import { API } from "./base"; import { ListData, ListParams } from "./types"; -import { AUTOMTAION_LIST, AUTOMTAION_ROOT } from './paths'; +import { AUTOMTAION_LIST, AUTOMTAION_ITEM } from './paths'; export const makeAutomationAPI = (api: API) => ({ @@ -14,19 +14,19 @@ export const makeAutomationAPI = (api: API) => ({ }); return data; }, - async update({index, auto}: {index: number, auto: AutomationData}) { + async update({ index, auto }: { index: number, auto: AutomationData }) { return await api.makeCall({ - path: AUTOMTAION_ROOT, + path: AUTOMTAION_ITEM, data: { index, data: auto }, }) }, - async remove({index}: {index: number}) { + async remove({ index }: { index: number }) { return await api.makeCall({ method: "DELETE", - path: AUTOMTAION_ROOT, + path: AUTOMTAION_ITEM, data: { index, } diff --git a/webapp/src/apiService/mock.ts b/webapp/src/apiService/mock.ts index 1a7b104..57c52bb 100644 --- a/webapp/src/apiService/mock.ts +++ b/webapp/src/apiService/mock.ts @@ -1,7 +1,7 @@ import { useRef } from 'react'; import { AutomationData } from 'types/automations'; import { API } from './base'; -import { AUTOMTAION_LIST, AUTOMTAION_ROOT } from './paths'; +import { AUTOMTAION_LIST, AUTOMTAION_ITEM } from './paths'; export const useMockAPI = ( @@ -26,7 +26,7 @@ export const useMockAPI = ( })) } as any } - if (path === AUTOMTAION_ROOT) { + if (path === AUTOMTAION_ITEM) { if (method === 'POST') { const { index, data: auto } = data as any; if (index >= automationsRef.current.length) { @@ -37,7 +37,7 @@ export const useMockAPI = ( auto, ...automationsRef.current.slice(index + 1) ]; - } + } return { ok: true, data: {} diff --git a/webapp/src/apiService/paths.ts b/webapp/src/apiService/paths.ts index 875bf20..64917cc 100644 --- a/webapp/src/apiService/paths.ts +++ b/webapp/src/apiService/paths.ts @@ -1,4 +1,5 @@ -export const AUTOMTAION_ROOT = '' as const; -export const AUTOMTAION_LIST = `${AUTOMTAION_ROOT}/list` as const; +export const AUTOMTAION_ROOT = '/' as const; +export const AUTOMTAION_LIST = `${AUTOMTAION_ROOT}list` as const; +export const AUTOMTAION_ITEM = `${AUTOMTAION_ROOT}item` as const;