Skip to content

Commit

Permalink
Improve release job
Browse files Browse the repository at this point in the history
  • Loading branch information
PiotrMachowski committed Jan 3, 2025
1 parent 7790ea6 commit 4e203d6
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,38 @@
---
name: Release

on:
release:
types: [published]

env:
COMPONENT_NAME: xiaomi_cloud_map_extractor

jobs:
release:
name: Prepare release
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- name: Download repo
uses: actions/checkout@v1
uses: actions/[email protected]

- name: Adjust version number
shell: bash
run: |
version="${{ github.event.release.tag_name }}"
yq e -P -o=json \
-i ".version = \"${version}\"" \
"${{ github.workspace }}/custom_components/${{ env.COMPONENT_NAME }}/manifest.json"
- name: Zip xiaomi_cloud_map_extractor dir
- name: Zip ${{ env.COMPONENT_NAME }} dir
run: |
cd /home/runner/work/Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor/Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor/custom_components/xiaomi_cloud_map_extractor
zip xiaomi_cloud_map_extractor.zip -r ./
cd "${{ github.workspace }}/custom_components/${{ env.COMPONENT_NAME }}"
zip ${{ env.COMPONENT_NAME }}.zip -r ./
- name: Upload zip to release
uses: svenstaro/upload-release-action@v1-release
uses: softprops/action-gh-release@v2.1.0
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: /home/runner/work/Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor/Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor/custom_components/xiaomi_cloud_map_extractor/xiaomi_cloud_map_extractor.zip
asset_name: xiaomi_cloud_map_extractor.zip
tag: ${{ github.ref }}
overwrite: true
files: ${{ github.workspace }}/custom_components/${{ env.COMPONENT_NAME }}/${{ env.COMPONENT_NAME }}.zip

0 comments on commit 4e203d6

Please sign in to comment.