forked from custom-components/places
-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (56 loc) · 2.76 KB
/
Copy pathrelease.yml
File metadata and controls
65 lines (56 loc) · 2.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Release
on:
workflow_dispatch:
release:
types: [published, edited]
jobs:
update_version_and_create_zip:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Debug Variables
run: |
echo "github.event_name: ${{ github.event_name }}"
echo "github.ref_name: ${{ github.ref_name }}"
echo "github.event.release.tag_name: ${{ github.event.release.tag_name }}"
echo "github.event.repository.default_branch: ${{ github.event.repository.default_branch }}"
echo "github.event.release.target_commitish: ${{ github.event.release.target_commitish }}"
echo "github.event.release.prerelease: ${{ github.event.release.prerelease }}"
echo "github.event.release.draft: ${{ github.event.release.draft }}"
- name: Update Version in Manifest
if: ${{ github.event_name == 'release' && github.event.release.draft == false }}
run: |
sed -i 's/\"version\"\s*\:\s*\".*\"/\"version\"\:\"${{ github.event.release.tag_name }}\"/g' ./custom_components/places/manifest.json
- name: Update Version in const.py
if: ${{ github.event_name == 'release' && github.event.release.draft == false }}
run: |
sed -i 's/^VERSION \= \".*\"/VERSION \= \"${{ github.event.release.tag_name }}\"/' ./custom_components/places/const.py
- name: Commit & Push Version Changes
if: ${{ github.event_name == 'release' && github.event.release.draft == false && github.event.release.prerelease == false }}
uses: stefanzweifel/git-auto-commit-action@v7
with:
branch: ${{ github.event.release.target_commitish }}
commit_message: 'Updating to version ${{ github.event.release.tag_name }} [skip ci]'
- name: Update Release with Version Changes Commit
if: ${{ github.event_name == 'release' && github.event.release.draft == false && github.event.release.prerelease == false }}
run: |
git tag -f ${{ github.event.release.tag_name }}
git push -f origin ${{ github.event.release.tag_name }}
- name: Create Zip
run: |
cd ${{ github.workspace }}/custom_components/places
zip places.zip -r ./
- name: Upload Zip to Release
if: ${{ github.event_name == 'release' && github.event.release.draft == false }}
uses: softprops/action-gh-release@v2
with:
files: ./custom_components/places/places.zip
tag_name: ${{ github.event.release.tag_name }}
- name: Add Zip to Action
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: actions/upload-artifact@v7
with:
name: places
path: ./custom_components/places/places.zip
if-no-files-found: error