Skip to content

Commit

Permalink
Merge pull request #156 from Snuffy2/Update-GitHub-Actions
Browse files Browse the repository at this point in the history
Update GitHub Actions
  • Loading branch information
alexdelprete authored Sep 6, 2024
2 parents db45b96 + a3388ab commit 3bd7d93
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 55 deletions.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 10
5 changes: 5 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
changelog:
exclude:
labels:
- ignore-for-release
- dependencies
20 changes: 20 additions & 0 deletions .github/workflows/ha_and_hacs_validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: HA and HACS Validate

on:
push:
pull_request:
workflow_dispatch:

jobs:
ha_and_hacs_validation:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Hassfest validation
uses: home-assistant/actions/hassfest@master
- name: HACS validation
uses: hacs/action@main
with:
category: integration
ignore: brands
20 changes: 0 additions & 20 deletions .github/workflows/hacs.yml

This file was deleted.

15 changes: 0 additions & 15 deletions .github/workflows/hassfest.yml

This file was deleted.

15 changes: 0 additions & 15 deletions .github/workflows/release.yml

This file was deleted.

59 changes: 59 additions & 0 deletions .github/workflows/version_update_and_zip_on_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Update Version and Create Zip on Release
on:
workflow_dispatch:
release:
types: [published, edited]

jobs:
update_version:
if: ${{ github.event_name == 'release' && github.event.release.prerelease == false && github.event.release.draft == false }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Debug Variables
run: |
echo "github.event_name: ${{ github.event_name }}"
echo "github.ref_name: ${{ github.ref_name }}"
echo "github.event.repository.default_branch: ${{ github.event.repository.default_branch }}"
echo "github.event.release.target_commitish: ${{ github.event.release.target_commitish }}"
echo "github.event.release.prerelease: ${{ github.event.release.prerelease }}"
echo "github.event.release.draft: ${{ github.event.release.draft }}"
- name: Update Version in Manifest
run: |
sed -i 's/\"version\"\s*\:\s*\".*\"/\"version\"\:\"${{ github.ref_name }}\"/g' ./custom_components/opnsense/manifest.json
- name: Update Version in const.py
run: |
sed -i 's/VERSION \= \".*\"/VERSION \= \"${{ github.ref_name }}\"/' ./custom_components/opnsense/const.py
- name: Commit & Push Version Changes
uses: actions-js/push@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.event.release.target_commitish }}
message: 'Updating to version ${{ github.ref_name }}'

create_zip:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Create Zip
uses: thedoctor0/[email protected]
with:
type: 'zip'
filename: 'opnsense.zip'
directory: ./custom_components/opnsense
- name: Upload Zip to Release
if: ${{ github.event_name == 'release' }}
uses: Roang-zero1/[email protected]
with:
args: ./custom_components/opnsense/opnsense.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Add Zip to Action
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: actions/[email protected]
with:
name: opnsense
path: ./custom_components/opnsense/opnsense.zip
if-no-files-found: error
4 changes: 1 addition & 3 deletions custom_components/opnsense/const.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""The OPNsense component."""

from __future__ import annotations

from typing import Final

from homeassistant.components.sensor import (
Expand All @@ -13,10 +11,10 @@
PERCENTAGE,
UnitOfFrequency,
UnitOfInformation,
UnitOfTemperature,
UnitOfTime,
)

VERSION = "0.1.0"
DEFAULT_USERNAME = ""
DOMAIN = "opnsense"

Expand Down
5 changes: 3 additions & 2 deletions hacs.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "OPNsense integration for Home Assistant",
"homeassistant": "2022.4.0",
"render_readme": true
"homeassistant": "2022.4.0b0",
"zip_release": true,
"filename": "opnsense.zip"
}

0 comments on commit 3bd7d93

Please sign in to comment.