Skip to content

Commit

Permalink
Update release flow
Browse files Browse the repository at this point in the history
  • Loading branch information
iMicknl committed Jan 7, 2024
1 parent 579aa9b commit a84118d
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 20 deletions.
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 "[email protected]"
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 }}

0 comments on commit a84118d

Please sign in to comment.