Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance release flow #89

Merged
merged 1 commit into from
Jan 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 25 additions & 20 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,40 @@
{
"image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye",
"name": "ha-sagemcom-fast",
"forwardPorts": [8123],
"portsAttributes": {
"forwardPorts": [
8123
],
"portsAttributes": {
"8123": {
"label": "Home Assistant",
"onAutoForward": "openBrowserOnce"
}
},
"features": {
"ghcr.io/devcontainers-contrib/features/ffmpeg-apt-get:1": {}
},
"postCreateCommand": "pip install -r requirements_dev.txt && pre-commit install && pre-commit install-hooks",
"containerEnv": {
"DEVCONTAINER": "1"
},
"remoteUser": "vscode",
"customizations": {
},
"remoteUser": "vscode",
"customizations": {
"vscode": {
"extensions": [
"ms-python.vscode-pylance",
"ms-python.python",
"redhat.vscode-yaml",
"esbenp.prettier-vscode",
"GitHub.vscode-pull-request-github",
"GitHub.copilot"
],
"settings": {
"python.pythonPath": "/usr/local/bin/python",
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true
}
"extensions": [
"ms-python.vscode-pylance",
"ms-python.python",
"redhat.vscode-yaml",
"esbenp.prettier-vscode",
"GitHub.vscode-pull-request-github",
"GitHub.copilot"
],
"settings": {
"python.pythonPath": "/usr/local/bin/python",
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true
}
}
}
}
37 changes: 37 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release Custom Component to HACS

on:
release:
types: [published]

jobs:
package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

# Retrieve new version to tag and publish release with
- name: Retrieve version from tag name
id: version
run: |
tag=${{ github.event.release.tag_name }}
version_number=${tag#?}
echo version: $version_number
echo "version=$version_number" >> $GITHUB_OUTPUT
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"

- name: Update manifest.json version to release version
uses: jossef/action-set-json-field@v2
with:
file: custom_components/sagemcom_fast/manifest.json
field: version
value: ${{ steps.version.outputs.version }}

- name: Commit changes
run: |
git add custom_components/sagemcom_fast/manifest.json
git commit -m "Bump version to ${{ steps.version.outputs.version }}."
git tag -f -a ${{ github.event.release.tag_name }} -m "Release ${{ steps.version.outputs.version }}."
git push origin HEAD:main
git push origin -f ${{ github.event.release.tag_name }}
Loading