Skip to content
This repository has been archived by the owner on Nov 23, 2023. It is now read-only.

Commit

Permalink
Develop (#153)
Browse files Browse the repository at this point in the history
* Update things to be in line with example

* Update build.yaml

* Use unified action workflows
  • Loading branch information
tjorim authored Nov 7, 2021
1 parent 567148f commit c7a22e6
Show file tree
Hide file tree
Showing 12 changed files with 61 additions and 242 deletions.
4 changes: 0 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
- package-ecosystem: docker
directory: "/filiicodex"
schedule:
Expand Down
19 changes: 0 additions & 19 deletions .github/release-drafter.yml

This file was deleted.

63 changes: 4 additions & 59 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,62 +6,7 @@ on:
tags: [v*]

jobs:
build:
name: Build image
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Login to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set add-on version
run: |
ADDON_VERSION=$( cut -c12- <<< ${{ github.ref }} )
sed -i "s/dev/$ADDON_VERSION/g" filiicodex/config.json
- name: Build and push tagged Docker image
uses: home-assistant/[email protected]
with:
args: |
--all \
--target filiicodex \
--image "filiicodex/{arch}" \
--docker-hub "ghcr.io/filii-lamberti"
publish:
needs: build
name: Publish release
runs-on: ubuntu-latest
steps:
- name: Checkout add-on code
uses: actions/[email protected]
with:
persist-credentials: false
path: addon
- name: Checkout repository code
uses: actions/[email protected]
with:
persist-credentials: false
repository: filii-lamberti/repository
path: repository
- name: Create local changes and commit files
continue-on-error: true
run: |
ADDON_NAME=$( cut -c22- <<< ${{ github.repository }} )
ADDON_VERSION=$( cut -c12- <<< ${{ github.ref }} )
cp -v addon/README.md addon/filiicodex/config.json repository/filiicodex/
cd repository
sed -i "s/dev/$ADDON_VERSION/g" filiicodex/config.json
git config --local user.email "[email protected]"
git config --local user.name "Filii Lamberti"
git add .
git commit -m "Upgrade $ADDON_NAME to v$ADDON_VERSION" -a
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
directory: repository
repository: filii-lamberti/repository
continuous-deployment:
uses: filii-lamberti/repository/.github/workflows/cd.yml@main
with:
addon: filiicodex
60 changes: 7 additions & 53 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,58 +3,12 @@ name: Continuous integration
on:
push:
# Sequence of patterns matched against refs/heads
branches: [master]
branches:
- master
- develop

jobs:
lint:
name: Lint code
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Use Node.js
uses: actions/[email protected]
with:
node-version: '14'
cache: 'npm'
cache-dependency-path: ./filiicodex/rootfs/opt/filiicodex/package-lock.json
- name: Install ESLint and dependencies
run: npm install
working-directory: ./filiicodex/rootfs/opt/filiicodex
- name: Run ESLint
run: node_modules/eslint/bin/eslint.js index.js
working-directory: ./filiicodex/rootfs/opt/filiicodex

test:
needs: lint
name: Test code
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Login to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set add-on version
run: |
sed -i "s/dev/latest/g" filiicodex/config.json
- name: Build and push latest Docker image
uses: home-assistant/[email protected]
with:
args: |
--amd64 \
--target filiicodex \
--image "filiicodex/{arch}" \
--docker-hub "ghcr.io/filii-lamberti"
update_release_draft:
name: Release Drafter
runs-on: ubuntu-latest
steps:
# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
continuous-integration:
uses: filii-lamberti/repository/.github/workflows/ci.yml@main
with:
addon: filiicodex
61 changes: 2 additions & 59 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
Expand All @@ -21,51 +10,5 @@ on:
- cron: '0 0 * * 0'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/[email protected]

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
codeql-analysis:
uses: filii-lamberti/repository/.github/workflows/codeql-analysis.yml@main
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Filii Lamberti
Copyright (c) 2021 Filii Lamberti

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
28 changes: 16 additions & 12 deletions filiicodex/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ RUN \
\
&& npm install --production \
\
&& npx mod-pruner init --force \
&& npx mod-pruner prune --force \
\
&& apk del --no-cache --purge .build-dependencies
Expand All @@ -37,23 +36,28 @@ COPY rootfs/opt/filiicodex/index.js /opt/filiicodex/
# Build arugments
ARG BUILD_ARCH
ARG BUILD_DATE
ARG BUILD_DESCRIPTION
ARG BUILD_NAME
ARG BUILD_REF
ARG BUILD_REPOSITORY
ARG BUILD_VERSION

# Labels
LABEL \
io.hass.name="Filiicodex" \
io.hass.description="A Filiicodex add-on for Home Assistant" \
io.hass.name="${BUILD_NAME}" \
io.hass.description="${BUILD_DESCRIPTION}" \
io.hass.arch="${BUILD_ARCH}" \
io.hass.type="addon" \
io.hass.version=${BUILD_VERSION} \
maintainer="Jorim Tielemans <[email protected]>" \
org.label-schema.description="A Filiicodex add-on for Home Assistant" \
org.label-schema.build-date=${BUILD_DATE} \
org.label-schema.name="Filiicodex" \
org.label-schema.schema-version="1.0" \
org.label-schema.url="https://addons.community" \
org.label-schema.usage="https://gitlab.com/filii-lamberti/addon-filiicodex" \
org.label-schema.vcs-ref=${BUILD_REF} \
org.label-schema.vcs-url="https://gitlab.com/filii-lamberti/filii-addons" \
org.label-schema.vendor="Filii Lamberti"
org.opencontainers.image.title="${BUILD_NAME}" \
org.opencontainers.image.description="${BUILD_DESCRIPTION}" \
org.opencontainers.image.vendor="Filii Lamberti" \
org.opencontainers.image.authors="Jorim Tielemans <[email protected]>" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.url="https://github.com/filii-lamberti/filii-addons" \
org.opencontainers.image.source="https://github.com/${BUILD_REPOSITORY}" \
org.opencontainers.image.documentation="https://github.com/${BUILD_REPOSITORY}/blob/main/README.md" \
org.opencontainers.image.created=${BUILD_DATE} \
org.opencontainers.image.revision=${BUILD_REF} \
org.opencontainers.image.version=${BUILD_VERSION}
11 changes: 0 additions & 11 deletions filiicodex/build.json

This file was deleted.

7 changes: 7 additions & 0 deletions filiicodex/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
build_from:
aarch64: ghcr.io/hassio-addons/base/aarch64:10.1.1
amd64: ghcr.io/hassio-addons/base/amd64:10.1.1
armhf: ghcr.io/hassio-addons/base/armhf:10.1.1
armv7: ghcr.io/hassio-addons/base/armv7:10.1.1
i386: ghcr.io/hassio-addons/base/i386:10.1.1
23 changes: 0 additions & 23 deletions filiicodex/config.json

This file was deleted.

23 changes: 23 additions & 0 deletions filiicodex/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Filiicodex
version: dev
slug: filiicodex
description: A Filiicodex add-on for Home Assistant
url: https://github.com/filii-lamberti/addon-filiicodex
init: false
arch:
- aarch64
- amd64
- armhf
- armv7
- i386
hassio_api: true
homeassistant_api: true
ports:
3000/tcp: 8051 # C+O+D+E+X
options:
schema:
purge: bool?
logging: bool?
debugging: bool?
image: ghcr.io/filii-lamberti/filiicodex/{arch}
2 changes: 1 addition & 1 deletion filiicodex/rootfs/etc/services.d/filiicodex/run
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Starts the Filiicodex
# ==============================================================================

# Set the current working dir to /opt
# Set the current working dir to /opt/filiicodex
cd /opt/filiicodex || bashio::exit.nok "Could not change directory to Filiicodex"

bashio::log.info "Starting Filiicodex..."
Expand Down

0 comments on commit c7a22e6

Please sign in to comment.