Skip to content

Update update-manifest.yml #13

Update update-manifest.yml

Update update-manifest.yml #13

Workflow file for this run

name: Update manifest.json and Prepare Release
on:
push:
tags:
- 'v*' # Trigger on tags that match version patterns like v1.0.0
jobs:
update-manifest:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
# Checkout the repository
- name: Checkout Code
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
# Extract the release version from the tag name
- name: Get Release Version
id: get_version
run: echo "release_version=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
# Update the manifest.json file with the release version
- name: Update manifest.json
run: |
version=${{ env.release_version }}
jq --arg version "$version" '.version = $version' ./custom_components/philips_airpurifier_coap/manifest.json > temp.json
mv temp.json ./custom_components/philips_airpurifier_coap/manifest.json
# Commit and push changes
- name: Commit and Push Changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name "kongo09"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add ./custom_components/philips_airpurifier_coap/manifest.json
git commit -m "Update manifest.json to version ${{ env.release_version }}"
git push origin :refs/tags/${{ github.ref_name }}
git tag -fa ${{ github.ref_name }} -m "Update to version ${{ github.ref_name }}"
git push origin ${{ github.ref_name }}
# Update the release
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: ${{ github.ref_name }}
draft: false
prerelease: ${{ github.event.release.prerelease }}