Release #9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Version (e.g. 0.5.0)" | |
| required: true | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Validate version format | |
| run: | | |
| if ! echo "${{ inputs.version }}" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then | |
| echo "::error::Invalid version format. Use semver (e.g. 0.5.0)" | |
| exit 1 | |
| fi | |
| - name: Check tag does not already exist | |
| run: | | |
| if git rev-parse "v${{ inputs.version }}" >/dev/null 2>&1; then | |
| echo "::error::Tag v${{ inputs.version }} already exists" | |
| exit 1 | |
| fi | |
| - name: Update manifest.json version | |
| run: | | |
| sed -i 's/"version": "[^"]*"/"version": "${{ inputs.version }}"/' \ | |
| custom_components/echonet_lite/manifest.json | |
| - name: Commit and tag | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add custom_components/echonet_lite/manifest.json | |
| git commit -m "Release v${{ inputs.version }}" | |
| git tag "v${{ inputs.version }}" | |
| git push origin HEAD --tags | |
| - name: ZIP echonet_lite Dir | |
| run: | | |
| cd ${{ github.workspace }}/custom_components/echonet_lite | |
| zip echonet_lite.zip -r ./ | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v3 | |
| with: | |
| tag_name: "v${{ inputs.version }}" | |
| generate_release_notes: true | |
| files: ${{ github.workspace }}/custom_components/echonet_lite/echonet_lite.zip |