-
Notifications
You must be signed in to change notification settings - Fork 11
54 lines (54 loc) · 2.55 KB
/
zip_on_release.yml
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
name: Create Zip on Release
on:
workflow_dispatch:
release:
types: [published, edited]
jobs:
create_zip:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Debug Variables
run: |
echo "github.event_name: ${{ github.event_name }}"
echo "github.ref_name: ${{ github.ref_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.prerelease == false && github.event.release.draft == false }}
run: |
sed -i 's/\"version\"\s*\:\s*\".*\"/\"version\"\:\"${{ github.ref_name }}\"/g' ./custom_components/animated_scenes/manifest.json
- name: Update Version in const.py
if: ${{ github.event_name == 'release' && github.event.release.prerelease == false && github.event.release.draft == false }}
run: |
sed -i 's/VERSION \= \".*\"/VERSION \= \"${{ github.ref_name }}\"/' ./custom_components/animated_scenes/const.py
- name: Commit & Push Version Changes
if: ${{ github.event_name == 'release' && github.event.release.prerelease == false && github.event.release.draft == false }}
uses: actions-js/push@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.event.release.target_commitish }}
message: 'Updating to version ${{ github.ref_name }}'
- name: Create Zip
uses: thedoctor0/[email protected]
with:
type: 'zip'
filename: 'animated_scenes.zip'
directory: ./custom_components/animated_scenes
- name: Upload Zip to Release
if: ${{ github.event_name == 'release' }}
uses: Roang-zero1/[email protected]
with:
args: ./custom_components/animated_scenes/animated_scenes.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Add Zip to Action
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: actions/[email protected]
with:
name: animated_scenes
path: ./custom_components/animated_scenes/animated_scenes.zip
if-no-files-found: error